David Smith

David Smith

  • NA
  • 2k
  • 0

Join two SQL queries in Access 2007

Jul 29 2012 6:33 AM

Can some help me combine this two queries into one sql, I am using Access 2007 at the moment. Basically SQL 2 below is going to return a dataset
Then when I call SQL 1, I have to Left Join from the dataset return from SQL 2, Can someone help

SQL 1

Select tblContact.ContactID, tblContact.FirstName, tblContact.LastName,
FROM (tblContact INNER JOIN
                         tblContactType ON tblContact.ContactID = tblContactType.ContactID)

SQL 2

(TRANSFORM First(tblContactType.ContactType) AS FirstOfContactType
SELECT      tblContactType.ContactID, First(tblContactType.ContactStatus) AS ContactStatus, COUNT(tblContactType.ContactType) AS Count
FROM            (tblContact INNER JOIN
                         tblContactType ON tblContact.ContactID = tblContactType.ContactID)
GROUP BY tblContactType.ContactId
Pivot 'ContactType')