ref #287, updates the SQL