UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Joining 2 queries    
 
   
ayeizajedi
post Sep 4 2007, 08:55 AM
Post #1

UtterAccess Member
Posts: 38
From: Newcastle, UK



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!
Go to the top of the page
 
+
adamsherring
post Sep 4 2007, 08:58 AM
Post #2

VIP Emeritus
Posts: 1,750
From: The Great White North



Hi,

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
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 08:54 PM