Multiple Queries Merged

R

Rod

Hello,

I have a series of queries which tell me:

Daily appointment totals
Weekly appointment totals
Monthly appointment totals.

I need all of this information for a single paged report. My understanding
is a report can only use a single query, so, my question is how can I merge
the above queries into a single StatSummary query which will then be used for
the report?

Thanks
 
O

Ofer

If all queries return the same structure of fields (include names), you can
use union query

Select Field1, Field2 From [Daily appointment totals] Union
Select Field1, Field2 From [Weekly appointment totals] Union
Select Field1, Field2 From [Monthly appointment totals]
 
R

Rod

I only need one field from each of the q so my test q looks like:

Select NumberBooked, From [qGoals Tracking - 1Sun CO Books] Union
Select NumberBooked, From [qGoals Tracking - 2Mon CO Books] Union
Select NumberBooked, From [qGoals Tracking - 3Tue CO Books] Union
Select NumberBooked, From [qGoals Tracking - 4Wed CO Books] Union
Select NumberBooked, From [qGoals Tracking - 5Thu CO Books] Union
Select NumberBooked, From [qGoals Tracking - 6Fri CO Books] Union
Select NumberBooked, From [qGoals Tracking - 7Sat CO Books]

I received an error:
The SELECT statement include a reserved word or an argument named that is
misspelled or missing, ot the punctuation is incorrect.


Ofer said:
If all queries return the same structure of fields (include names), you can
use union query

Select Field1, Field2 From [Daily appointment totals] Union
Select Field1, Field2 From [Weekly appointment totals] Union
Select Field1, Field2 From [Monthly appointment totals]


--
\\// Live Long and Prosper \\//
BS"D


Rod said:
Hello,

I have a series of queries which tell me:

Daily appointment totals
Weekly appointment totals
Monthly appointment totals.

I need all of this information for a single paged report. My understanding
is a report can only use a single query, so, my question is how can I merge
the above queries into a single StatSummary query which will then be used for
the report?

Thanks
 
O

Ofer

You have (,) after the field name, when you dont have a second field.
Try this
Select NumberBooked From [qGoals Tracking - 1Sun CO Books] Union
Select NumberBooked From [qGoals Tracking - 2Mon CO Books] Union
Select NumberBooked From [qGoals Tracking - 3Tue CO Books] Union
Select NumberBooked From [qGoals Tracking - 4Wed CO Books] Union
Select NumberBooked From [qGoals Tracking - 5Thu CO Books] Union
Select NumberBooked From [qGoals Tracking - 6Fri CO Books] Union
Select NumberBooked From [qGoals Tracking - 7Sat CO Books]

--
\\// Live Long and Prosper \\//
BS"D


Rod said:
I only need one field from each of the q so my test q looks like:

Select NumberBooked, From [qGoals Tracking - 1Sun CO Books] Union
Select NumberBooked, From [qGoals Tracking - 2Mon CO Books] Union
Select NumberBooked, From [qGoals Tracking - 3Tue CO Books] Union
Select NumberBooked, From [qGoals Tracking - 4Wed CO Books] Union
Select NumberBooked, From [qGoals Tracking - 5Thu CO Books] Union
Select NumberBooked, From [qGoals Tracking - 6Fri CO Books] Union
Select NumberBooked, From [qGoals Tracking - 7Sat CO Books]

I received an error:
The SELECT statement include a reserved word or an argument named that is
misspelled or missing, ot the punctuation is incorrect.


Ofer said:
If all queries return the same structure of fields (include names), you can
use union query

Select Field1, Field2 From [Daily appointment totals] Union
Select Field1, Field2 From [Weekly appointment totals] Union
Select Field1, Field2 From [Monthly appointment totals]


--
\\// Live Long and Prosper \\//
BS"D


Rod said:
Hello,

I have a series of queries which tell me:

Daily appointment totals
Weekly appointment totals
Monthly appointment totals.

I need all of this information for a single paged report. My understanding
is a report can only use a single query, so, my question is how can I merge
the above queries into a single StatSummary query which will then be used for
the report?

Thanks
 
R

Rod

Excellent! Thanks!

Ofer said:
You have (,) after the field name, when you dont have a second field.
Try this
Select NumberBooked From [qGoals Tracking - 1Sun CO Books] Union
Select NumberBooked From [qGoals Tracking - 2Mon CO Books] Union
Select NumberBooked From [qGoals Tracking - 3Tue CO Books] Union
Select NumberBooked From [qGoals Tracking - 4Wed CO Books] Union
Select NumberBooked From [qGoals Tracking - 5Thu CO Books] Union
Select NumberBooked From [qGoals Tracking - 6Fri CO Books] Union
Select NumberBooked From [qGoals Tracking - 7Sat CO Books]

--
\\// Live Long and Prosper \\//
BS"D


Rod said:
I only need one field from each of the q so my test q looks like:

Select NumberBooked, From [qGoals Tracking - 1Sun CO Books] Union
Select NumberBooked, From [qGoals Tracking - 2Mon CO Books] Union
Select NumberBooked, From [qGoals Tracking - 3Tue CO Books] Union
Select NumberBooked, From [qGoals Tracking - 4Wed CO Books] Union
Select NumberBooked, From [qGoals Tracking - 5Thu CO Books] Union
Select NumberBooked, From [qGoals Tracking - 6Fri CO Books] Union
Select NumberBooked, From [qGoals Tracking - 7Sat CO Books]

I received an error:
The SELECT statement include a reserved word or an argument named that is
misspelled or missing, ot the punctuation is incorrect.


Ofer said:
If all queries return the same structure of fields (include names), you can
use union query

Select Field1, Field2 From [Daily appointment totals] Union
Select Field1, Field2 From [Weekly appointment totals] Union
Select Field1, Field2 From [Monthly appointment totals]


--
\\// Live Long and Prosper \\//
BS"D


:

Hello,

I have a series of queries which tell me:

Daily appointment totals
Weekly appointment totals
Monthly appointment totals.

I need all of this information for a single paged report. My understanding
is a report can only use a single query, so, my question is how can I merge
the above queries into a single StatSummary query which will then be used for
the report?

Thanks
 
Top