I'm really not sure how to title this question... Imagine that we have a table looking like this:
object | attribute | value
------------------------------
7 country Germany
7 position 12
7 points 12
8 country Germany
8 position 10
8 points 3
Now I want to select all object identifiers that has country germany and position 12 or 5
I have no idea how to write this query, is it possible?
Join as many times as you need additional query options:
SELECT t1.object
FROM table t1
INNER JOIN table t2 ON t1.object = t2.object
WHERE t1.attribute = 'country' AND t1.value = 'Germany'
AND t2.attribute = 'position' AND t2.value IN (12,5)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With