Customer SQL query syntax error fixes