I’m new to Oracle SQL but have worked in MS SQL Server before. I need help converting my query.
I have 2 tables:
Table A
CallDate CallID Segnum
1/1/2005 12:04:50 AM 123 1
1/1/2005 12:34:12 AM 123 2
1/1/2005 12:34:12 AM 123 3
1/2/2005 08:42:15 PM 234 1
1/2/2005 08:55:10 PM 234 2
5/2/2005 02:35:16 PM 123 2
Table B
CallDate CallID Segnum
1/1/2005 123 1
1/1/2005 123 3
1/2/2005 234 1
1/2/2005 234 2
I want to pull all records in Table A where both the CallDate and CallID values exist in Table B but the Segnum value doesn’t match. (I want to ignore the time stamp in Table A when comparing date values to Table B.)
So the result I would get from the above example would be one record:
CallDate CallID Segnum
1/1/2005 12:34:12 AM 123 2
My SQL Server query would be something like this?
Select *
from TableA
where segnum not in
(select segnum
from TableB
where TableB.CallID = TableA.CallID
and TableB.CallDate = formatdate(TableA.CallDate,"mm/dd/yyyy")
I have 2 tables:
Table A
CallDate CallID Segnum
1/1/2005 12:04:50 AM 123 1
1/1/2005 12:34:12 AM 123 2
1/1/2005 12:34:12 AM 123 3
1/2/2005 08:42:15 PM 234 1
1/2/2005 08:55:10 PM 234 2
5/2/2005 02:35:16 PM 123 2
Table B
CallDate CallID Segnum
1/1/2005 123 1
1/1/2005 123 3
1/2/2005 234 1
1/2/2005 234 2
I want to pull all records in Table A where both the CallDate and CallID values exist in Table B but the Segnum value doesn’t match. (I want to ignore the time stamp in Table A when comparing date values to Table B.)
So the result I would get from the above example would be one record:
CallDate CallID Segnum
1/1/2005 12:34:12 AM 123 2
My SQL Server query would be something like this?
Select *
from TableA
where segnum not in
(select segnum
from TableB
where TableB.CallID = TableA.CallID
and TableB.CallDate = formatdate(TableA.CallDate,"mm/dd/yyyy")