fix a sql statement