Reputation: 196
I do have a problem with a query. I spend hours trying to find a way to make it work but I can't :( Even if it feels easy !
Let's say I have this table:
entity_id delta name
----------------------------
1 0 speaker
1 1 screen
2 0 mouse
2 1 TV
2 2 tablet
I simply want to return the entity id of a content where name != 'speaker' (in this example, it would be entity_id = 2).
If I use "name LIKE 'speaker'", it returns me entity 1. But I want the other way. So I try to use "name NOT LIKE 'test'", it returns me all the other rows, which is normal, but I would like to only get entity_id 2.
I feel like I am missing something easy.
Thanks for you help !
Ed
Upvotes: 0
Views: 260
Reputation: 204746
select entity_id
from your_table
group by entity_id
having sum(name = 'test') = 0
Upvotes: 1