I have a field (data1) where there is a user_id, level, and key_id. Each user can have multiple key_id's, and each key_id has a unique value 0-4.
What I am looking to do is return ONE user_id ONLY if ALL of their levels are 0. So for the below table, the only result returned should be 55012, because all three levels are 0.
Code:
user_id | key_id | level
----------------------
55012 | 1495 | 0
55012 | 2495 | 0
55012 | 3495 | 0
55212 | 1491 | 0
55212 | 2492 | 3
55212 | 3493 | 1
TIA for the help!