Fixed a syntax error in a sql statement