Fixed sql query syntax error