Let's say I have a table like this:
+----------+--------+
| brand | vehicle|
+----------+--------+
| ford | car |
| ford | truck |
| ford | suv |
+----------+--------+
I want to write one query that returns a brand when all 3 rows satisfy the conditions. For example, if I say, βgive me a brand that has a car, but not a truck or suv,β I expect the request to return nothing, since βfordβ has all 3. Unfortunately, the request I built does not work : / p>
SELECT brand
FROM table
WHERE vehicle='car'
AND vehicle != 'truck'
AND vehicle != 'suv';
The request returns "ford". I understand why he did it. He tested the conditions for each row, and row 1 passed, so the brand from row 1 is returned. But how can I build a query to accomplish what I need?