D
dids72
I am having an issue with a SQL query I put together using information
from this site. Unfortunately I do not have any knowledge of SQL or
writing query’s so I am looking for a little help to resolve the
issue. The issue is when I put in my date range it doesn’t appear to
actually be using the specified range correctly.
For example. If I put in the date 07/01/08 in the QUEUE Start box
and then put the date 02/01/09 in the QUEUE END box. It is including
data from 03/17/09 in the SUM total for each report which it shouldn’t
do since it is outside the date range specified.
I have listed below a small cross section of my table data for example
and the SQL I am using. Any help would be greatly appreciated.
RAW DATA TABLE:
REPORT PAGES QUEUE
AI001841 3 07/17/08
AI001841 6 09/17/08
AI001841 3 01/17/09
AI001841 6 03/17/09
SQL STATEMENT:
SELECT [Nightly Purge Table].REPORT, Sum([Nightly Purge Table].PAGES)
AS PAGESQTY, [QUEUE Start] AS QUEUESTART, [QUEUE END] AS QUEUEEND
FROM [Nightly Purge Table]
WHERE ((([Nightly Purge Table].QUEUE) Between [QUEUE Start] And [QUEUE
END]))
GROUP BY [Nightly Purge Table].REPORT;
INCORRECT RESULTS:
REPORT PAGESQTY QUEUESTART QUEUEEND
AI001841 18 07/01/08 02/01/09
SHOULD BE :
REPORT PAGESQTY QUEUESTART QUEUEEND
AI001841 12 07/01/08 02/01/09
from this site. Unfortunately I do not have any knowledge of SQL or
writing query’s so I am looking for a little help to resolve the
issue. The issue is when I put in my date range it doesn’t appear to
actually be using the specified range correctly.
For example. If I put in the date 07/01/08 in the QUEUE Start box
and then put the date 02/01/09 in the QUEUE END box. It is including
data from 03/17/09 in the SUM total for each report which it shouldn’t
do since it is outside the date range specified.
I have listed below a small cross section of my table data for example
and the SQL I am using. Any help would be greatly appreciated.
RAW DATA TABLE:
REPORT PAGES QUEUE
AI001841 3 07/17/08
AI001841 6 09/17/08
AI001841 3 01/17/09
AI001841 6 03/17/09
SQL STATEMENT:
SELECT [Nightly Purge Table].REPORT, Sum([Nightly Purge Table].PAGES)
AS PAGESQTY, [QUEUE Start] AS QUEUESTART, [QUEUE END] AS QUEUEEND
FROM [Nightly Purge Table]
WHERE ((([Nightly Purge Table].QUEUE) Between [QUEUE Start] And [QUEUE
END]))
GROUP BY [Nightly Purge Table].REPORT;
INCORRECT RESULTS:
REPORT PAGESQTY QUEUESTART QUEUEEND
AI001841 18 07/01/08 02/01/09
SHOULD BE :
REPORT PAGESQTY QUEUESTART QUEUEEND
AI001841 12 07/01/08 02/01/09