Full Version: Joining 2 queries
UtterAccess Discussion Forums > Microsoft® Access > Access Queries
Hi all,

I currently have 2 seperate queries that display output detailing currently assigned tasks.

The first of which displays the amount of tasks people have in an open state.

SELECT tbl_Tasks.INC_AE, Count(*) AS Expr1
FROM tbl_Tasks_Status_Lookup INNER JOIN tbl_Tasks ON tbl_Tasks_Status_Lookup.ID = tbl_Tasks.INC_Status
GROUP BY tbl_Tasks.INC_AE, tbl_Tasks_Status_Lookup.Description
HAVING (((tbl_Incidents_Tasks_Lookup.Description)="Open"));

The other displays the amount of tasks that have been assigned today.

SELECT tbl_Tasks.INC_AE, Count(*) AS Expr1
FROM tbl_Incidents_Tasks_Lookup INNER JOIN tbl_Tasks ON tbl_Incidents_Tasks_Lookup.ID = tbl_Tasks.INC_Status
WHERE (((tbl_Tasks.INC_DateAssigned) Between Date() And Date()+1))
GROUP BY tbl_Tasks.INC_AE;

Is there a way to have the join these two queries together so that the output would be as follows:

AE (Name) | Currently Open | Daily Assigned
Joe Bloggs | 25 | 10
Jim Smith | 12 | 4

etc, etc.

Thanks in advance!

Well, start by renaming your 'Expr1' fields to meaningful names. Then you can either :

Create the new query as one, or save both of your queries under different names. I suggest the latter, as they may prove useful seperated at a later time.

Lets call the first one query1 and the second one query2.

Create a new query; SQL :

Select * from query1 inner join query2 on query1.INC_AE = query2.INC_AE

Hope this helps
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.