If I have a table with three columns
userid,eventid,entrytime
and values like
userid,eventid,entrytime
1 1 NULL
2 1 2012-01-01
1 2 2012-01-01
2 2 2012-01-01
3 1 NULL
3 2 NULL
What is the best way of selecting userids where entrytime has always been NULL
Since a
COUNT(entrytime)aggregate will eliminate NULL values, you can use it to determine whichuseridhas no non-null value forentrytimeby comparing it to 0 in theHAVINGclause.Here is a live demonstration (Result is
userid= 3)