I have a table that looks like this:
person dateTime status
--------------------------
...
jke 15-05-2004 1
jke 15-05-2004 2
abc 16-05-2004 1
abc 17-05-2004 2
cde 17-05-2004 1
jke 17-05-2004 1
jke 17-05-2004 2
...
(People log in and log out of a system.)
I need to pull out all a list of those "persons" that have a "status" 1, but not a "status" 2. In other words, they have one more "status" 2 than 1.. For that day.
What would the SQL be for this?
person dateTime status
--------------------------
...
jke 15-05-2004 1
jke 15-05-2004 2
abc 16-05-2004 1
abc 17-05-2004 2
cde 17-05-2004 1
jke 17-05-2004 1
jke 17-05-2004 2
...
(People log in and log out of a system.)
I need to pull out all a list of those "persons" that have a "status" 1, but not a "status" 2. In other words, they have one more "status" 2 than 1.. For that day.
What would the SQL be for this?