Fix expected SQL query