W
wanglede
Hi, I am trying to create a Monthly Summary Report. The only way I can get
the information correctly is to create three different queries. I would like
to create a report based on 1 query. I have tried to make a query with the
relationship between the 3 queries linked through AREA (as this is common
with all 3 queries); but I am not getting the same results. I need to count
how many days a dismantle, erection, or mod has been completed per month per
area. I also need to get the sum of hours. How would I create a report based
on the three queries. The wizard does not allow me to use the 3 queries to
generate a report; I am in the process of trying to build a report from
scratch, but would prefer to use the wizard.
I have read about unions but I do not know if it would work for this
application.
Any suggestions?
Thanks
QUERY 1:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH
DISMANTLE DATE], Count([WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]) AS
[CountOfSCH DISMANTLE DATE], Sum([WCS SCAFFOLD TABLE].[PLAN DISM HOURS]) AS
[Sum Of PLAN DISM HOURS], Sum([WCS SCAFFOLD TABLE].[ACT DISM HOURS]) AS [Sum
Of ACT DISM HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]) Between [Type Beginning
Date:] And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;
QUERY 2:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH
ERECTION DATE], Count([WCS SCAFFOLD TABLE].[SCH ERECTION DATE]) AS
[CountOfSCH ERECTION DATE], [WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE], Count
([WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE]) AS [CountOfUNSCH ERECTION DATE],
Sum([WCS SCAFFOLD TABLE].[PLAN ERECT HOURS]) AS [Sum Of PLAN ERECT HOURS],
Sum([WCS SCAFFOLD TABLE].[ACT ERECT HOURS]) AS [Sum Of ACT ERECT HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH ERECTION DATE],
[WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH ERECTION DATE]) Between [Type Beginning
Date:] And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;
QUERY 3:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH MODS
DATE], Count([WCS SCAFFOLD TABLE].[SCH MODS DATE]) AS [CountOfSCH MODS DATE],
[WCS SCAFFOLD TABLE].[UNSCH MODS DATE], Count([WCS SCAFFOLD TABLE].[UNSCH
MODS DATE]) AS [CountOfUNSCH MODS DATE], Sum([WCS SCAFFOLD TABLE].[ACT MOD
HOURS]) AS [Sum Of ACT MOD HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH MODS DATE],
[WCS SCAFFOLD TABLE].[UNSCH MODS DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH MODS DATE]) Between [Type Beginning Date:]
And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;
the information correctly is to create three different queries. I would like
to create a report based on 1 query. I have tried to make a query with the
relationship between the 3 queries linked through AREA (as this is common
with all 3 queries); but I am not getting the same results. I need to count
how many days a dismantle, erection, or mod has been completed per month per
area. I also need to get the sum of hours. How would I create a report based
on the three queries. The wizard does not allow me to use the 3 queries to
generate a report; I am in the process of trying to build a report from
scratch, but would prefer to use the wizard.
I have read about unions but I do not know if it would work for this
application.
Any suggestions?
Thanks
QUERY 1:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH
DISMANTLE DATE], Count([WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]) AS
[CountOfSCH DISMANTLE DATE], Sum([WCS SCAFFOLD TABLE].[PLAN DISM HOURS]) AS
[Sum Of PLAN DISM HOURS], Sum([WCS SCAFFOLD TABLE].[ACT DISM HOURS]) AS [Sum
Of ACT DISM HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH DISMANTLE DATE]) Between [Type Beginning
Date:] And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;
QUERY 2:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH
ERECTION DATE], Count([WCS SCAFFOLD TABLE].[SCH ERECTION DATE]) AS
[CountOfSCH ERECTION DATE], [WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE], Count
([WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE]) AS [CountOfUNSCH ERECTION DATE],
Sum([WCS SCAFFOLD TABLE].[PLAN ERECT HOURS]) AS [Sum Of PLAN ERECT HOURS],
Sum([WCS SCAFFOLD TABLE].[ACT ERECT HOURS]) AS [Sum Of ACT ERECT HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH ERECTION DATE],
[WCS SCAFFOLD TABLE].[UNSCH ERECTION DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH ERECTION DATE]) Between [Type Beginning
Date:] And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;
QUERY 3:
SELECT DISTINCTROW [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH MODS
DATE], Count([WCS SCAFFOLD TABLE].[SCH MODS DATE]) AS [CountOfSCH MODS DATE],
[WCS SCAFFOLD TABLE].[UNSCH MODS DATE], Count([WCS SCAFFOLD TABLE].[UNSCH
MODS DATE]) AS [CountOfUNSCH MODS DATE], Sum([WCS SCAFFOLD TABLE].[ACT MOD
HOURS]) AS [Sum Of ACT MOD HOURS]
FROM [WCS SCAFFOLD TABLE]
GROUP BY [WCS SCAFFOLD TABLE].AREA, [WCS SCAFFOLD TABLE].[SCH MODS DATE],
[WCS SCAFFOLD TABLE].[UNSCH MODS DATE]
HAVING ((([WCS SCAFFOLD TABLE].[SCH MODS DATE]) Between [Type Beginning Date:]
And [Type End Date:]))
ORDER BY [WCS SCAFFOLD TABLE].AREA;