correcting SQL statement