fix sql statement