Here’s my code. I’m not sure what I am doing wrong with it. The database is named inventory, the table is named data. I am trying to order from the earliest date in a field named check_up date, and pull the first two earliest. I want to exclude users that have the names “nobody”, “mainconf” and “testing”:
SELECT user
FROM data
ORDER by checkup_date
WHERE data.name != "nobody"
AND WHERE data.name != "mainconf"
AND WHERE data.name != "testing" ASC
LIMIT 2
Here’s my error:
(1064, 'You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near
\'WHERE data.name != "nobody" AND WHERE data.name != "mainconf" AND WHERE
data.nam\' at line 1')
These are the errors:
ORDER BYmust be after theWHEREclausole and before theLIMITWHERE. Just write theANDand you’ve done.