correcting sql