S
Si
Could someone assist with the following query?
In short, I want to see the count of updates per day, and a total,
from 3 different tables. The query runs OK, however the information is
incorrect as the totals decrease on a daily basis (as time goes on)
which should not be the case.
This is my query:
SELECT
temp.DLL_Date,
count(table1) AS TABLE1_count,
count(table2) AS TABLE2_count,
count(TABLE3) AS TABLE3_Count,
Count(table1)+count(table2)+Count(TABLE3) AS Total
FROM [SELECT table2_tracking.LSTDLLDATE AS DLL_Date,
table2_tracking.INDEX1 as table2,
Null as table1,
null as TABLE3
FROM table2_tracking
WHERE table2_tracking.LOADFILE='table2.exe'
UNION
SELECT table1_tracking.LSTDLLDATE AS DLL_Date,
Null as table2 ,table1_tracking.INDEX1 as table1,
null as table3
FROM table1_tracking
WHERE table1_tracking.LOADFILE='table1.exe'
union
SELECT table3_tracking.LSTDLLDATE AS DLL_Date,
null as table2,
null as table1,
table3_tracking.INDEX1 as TABLE3
FROM table3_tracking
WHERE table3_tracking.LOADFILE=table3.exe]. AS temp
GROUP BY temp.DLL_Date
ORDER BY dll_date DESC;
In short, I want to see the count of updates per day, and a total,
from 3 different tables. The query runs OK, however the information is
incorrect as the totals decrease on a daily basis (as time goes on)
which should not be the case.
This is my query:
SELECT
temp.DLL_Date,
count(table1) AS TABLE1_count,
count(table2) AS TABLE2_count,
count(TABLE3) AS TABLE3_Count,
Count(table1)+count(table2)+Count(TABLE3) AS Total
FROM [SELECT table2_tracking.LSTDLLDATE AS DLL_Date,
table2_tracking.INDEX1 as table2,
Null as table1,
null as TABLE3
FROM table2_tracking
WHERE table2_tracking.LOADFILE='table2.exe'
UNION
SELECT table1_tracking.LSTDLLDATE AS DLL_Date,
Null as table2 ,table1_tracking.INDEX1 as table1,
null as table3
FROM table1_tracking
WHERE table1_tracking.LOADFILE='table1.exe'
union
SELECT table3_tracking.LSTDLLDATE AS DLL_Date,
null as table2,
null as table1,
table3_tracking.INDEX1 as TABLE3
FROM table3_tracking
WHERE table3_tracking.LOADFILE=table3.exe]. AS temp
GROUP BY temp.DLL_Date
ORDER BY dll_date DESC;