Here is an issue that has me stumped for the past few days. I have a
table called MerchTran. Among various columns, the relevant columns for
this issue are:
FileDate datetime
, SourceTable varchar(25)
SQL statement:
SELECT DISTINCT
FileDate
, SourceTable
FROM
MerchTran
ORDER BY
FileDate
, SourceTable
Data looks like this:
FileDate DataSource
-----------------------------------
2005-02-13 00:00:00.000 S1
2005-02-13 00:00:00.000 S2
2005-02-13 00:00:00.000 S3
2005-02-14 00:00:00.000 S1
2005-02-14 00:00:00.000 S2
2005-02-14 00:00:00.000 S3
2005-02-15 00:00:00.000 S2
2005-02-15 00:00:00.000 S3
2005-02-16 00:00:00.000 S1
2005-02-16 00:00:00.000 S2
2005-02-16 00:00:00.000 S3
2005-02-17 00:00:00.000 S1
2005-02-17 00:00:00.000 S2
2005-02-18 00:00:00.000 S1
2005-02-18 00:00:00.000 S2
2005-02-18 00:00:00.000 S3
2005-02-19 00:00:00.000 S1
2005-02-19 00:00:00.000 S3
We run a daily process that inserts data in to this table everyday for
all 3 sources S1, S2, S3
Notice how some data is missing indicating the import process for that
particular source failed.
Example: Missing record
2005-02-15 00:00:00.000 S1
2005-02-17 00:00:00.000 S3
2005-02-19 00:00:00.000 S2
Can someone please help me with a SQL Statement that will return me the
3 missing records as above.
Thanks in advance for all your help!
DBA in distress!
Vishal