In MySQL, is it possible to select two values from a column (with limit 2), excluding certain values? We have a database with inventory, and I want to send an email to users when they have a machine update that is going to take place. However, in this same inventory system, we have the "nobody" (about 10 of them) and "mainconf" (one of them) user, which are not actual users, and won't be receiving an email.
So basically I want to pull 2 values (which are ordered by date, and I know how to do that), which exclude certain values (i.e. "nobody") from being pulled.
So would my query look like this:
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