I need to make a mySQL query and am not sure what the format should be.
Here is the situation, I have a table with the fields – id, name, type
I would use a query similar to the following to get results from the table:
SELECT * FROM table WHERE type='1'
However, I have a list of ID’s from another query. These are items that should be excluded from the results.
I’m sure the answer is simple, but I don’t know enough about mySQL queries to find the answer.
A simple NOT IN will be what you want 🙂 It lets you send a list of values and makes sure that its not in them 🙂
You could also do it with a subquery with something like: