Mysql Query Exclude a certain entry
mysql, set
Solution
You can use a subquery for this:
SELECT name
FROM table
WHERE type = $type
AND name NOT IN (SELECT entry FROM t WHERE id = $id );
Problem
I'm trying to SELECT entries of a certain type, name, EXCLUDING entries with the same name in a particular id. The last part is the tricky part that I can't get my head around. ``` SELECT name FROM table WHERE type = $type AND (name is not contained in an entry with id). ``` I want the result to be the set of all names that ARE of a certain type but NOT already included in a current id. Do I need to execute two queries here? Or can I condense it to one. Thanks.