Store Query Results in a Temporary Table (1 Viewer)

JithuAccess

Member
Local time
Today, 10:43
Joined
Mar 3, 2020
Messages
297
LOL. That's what I said earlier. Didn't know you jumped ahead. :)
Hello DB Guy,

I have created a Union Query and this is my Query Result:

1619209754119.png


Could you please let me know how to use Cross Tab Query. The result should be like:

1619210002020.png


Thanks a lot
 

Attachments

  • 1619209917718.png
    1619209917718.png
    3.3 KB · Views: 101

theDBguy

I’m here to help
Staff member
Local time
Today, 09:43
Joined
Oct 29, 2018
Messages
21,358
Hi. You'll need to adjust your UNION query result to come up like this, if you want to be able to produce a CROSSTAB query like that.
Code:
Dept1  11
Dept2  8
Dept3  3
and so on...
 

JithuAccess

Member
Local time
Today, 10:43
Joined
Mar 3, 2020
Messages
297
Hi. You'll need to adjust your UNION query result to come up like this, if you want to be able to produce a CROSSTAB query like that.
Code:
Dept1  11
Dept2  8
Dept3  3
and so on...
Thanks a lot. Do you have any idea how to do this?
This is my Query:

Code:
Select [Total Corrsepondence] from [QryDepartment1] Union all
Select [Total Corrsepondence] from [QryDepartment2] Union all
Select [Total Corrsepondence] from [QryDepartment3] Union all
Select [Total Corrsepondence] from [QryDepartment4] Union all
Select [Total Corrsepondence] from [QryDepartment5] Union all
Select [Total Corrsepondence] from [QryDepartment6] Union all
Select [Total Corrsepondence] from [QryDepartment7] Union all
Select [Total Corrsepondence] from [QryDepartment8]

Here [Total Correspondence] is Field Name and [QryDepartment1] is Query Name

Thanks
 

theDBguy

I’m here to help
Staff member
Local time
Today, 09:43
Joined
Oct 29, 2018
Messages
21,358
Thanks a lot. Do you have any idea how to do this?
This is my Query:

Code:
Select [Total Corrsepondence] from [QryDepartment1] Union all
Select [Total Corrsepondence] from [QryDepartment2] Union all
Select [Total Corrsepondence] from [QryDepartment3] Union all
Select [Total Corrsepondence] from [QryDepartment4] Union all
Select [Total Corrsepondence] from [QryDepartment5] Union all
Select [Total Corrsepondence] from [QryDepartment6] Union all
Select [Total Corrsepondence] from [QryDepartment7] Union all
Select [Total Corrsepondence] from [QryDepartment8]

Here [Total Correspondence] is Field Name and [QryDepartment1] is Query Name

Thanks
Yes, try it this way...
Code:
SELECT "Dept1" As Dept, [Total Correspondence] FROM qryDepartment1
UNION
SELECT "Dept2", [Total Correspondence] FROM qryDepartment2
UNION
SELECT "Dept3", ... and so on.
 

Users who are viewing this thread

Top Bottom