I have a table named "letters
" with two columns looking like this:
case_nr | date
--------+-----------------------
1 | 2015-06-13 12:45:04
1 | NULL
2 | 2015-06-11 12:45:09
3 | 2015-06-12 17:41:49
3 | 2015-06-13 18:42:99
case_nr
1 have printed 2 letters but only one was sent
I want to filter all cases where all letters was sent (have a date)
So in this case result should be:
2
3
You can use
DISTINCT
withNOT IN
:Result:
Sample result in SQL Fiddle.