Updated the SQL query to match the one in server.js