forgot the SQL.
various small fixes for qtable.