I have two queries. The first query:
select in_gentime
from in_time_temp
where cardnumber = 'MCL1570'
order by in_gentime
Output is:
2011-10-11 08:06:00.000
2011-10-12 08:35:00.000
2011-10-13 08:21:00.000
2011-10-15 08:21:00.000
2011-10-16 08:21:00.000
2011-10-17 08:21:00.000
2011-10-18 08:21:00.000
2011-10-19 08:21:00.000
2011-10-20 08:21:00.000
2011-10-21 08:21:00.000
2011-10-22 08:21:00.000
2011-10-24 08:21:00.000
2011-10-25 08:21:00.000
2011-10-26 09:00:00.000
2011-10-27 09:00:00.000
2011-10-28 09:00:00.000
2011-10-29 09:00:00.000
2011-10-31 09:00:00.000
The second query:
select out_gentime
from out_time_temp
where cardnumber = 'MCL1570'
order by out_gentime
Output is:
2011-10-11 22:02:00.000
2011-10-12 21:14:00.000
2011-10-14 21:59:00.000
2011-10-15 21:59:00.000
2011-10-16 21:59:00.000
2011-10-17 21:59:00.000
2011-10-18 21:59:00.000
2011-10-19 21:59:00.000
2011-10-20 21:59:00.000
2011-10-21 21:59:00.000
2011-10-22 21:59:00.000
2011-10-24 21:59:00.000
2011-10-25 21:59:00.000
2011-10-26 18:15:00.000
2011-10-27 18:15:00.000
2011-10-28 18:15:00.000
2011-10-29 23:15:00.000
2011-10-31 22:15:00.000
I need to identify records that have DATE values that appear in one table but not the other. I want to ignore the specific TIME. For example, I want to only return these 2 records:
2011-10-13 08:21:00.000
2011-10-14 21:59:00.000
How can I write a query to do this?
If you use a
FULL OUTER JOIN, you can join together the list of dates and then just pick the records where one or the other is NULL:Update. Nathan, here is the full test code, I’m not sure why you are not getting results, but this returns 4 records when I run it:
And the output is: