jonathanchye
Registered User.
- Local time
- Today, 17:49
- Joined
- Mar 8, 2011
- Messages
- 448
Hi all,
I have two queries which basically is the same (from same table) but having different criterias. How do I merge them into one single query which uses Month as the common field?
Below are the SQL code for both my queries :
Query 1 :
Query 2 :
Many thanks.
I have two queries which basically is the same (from same table) but having different criterias. How do I merge them into one single query which uses Month as the common field?
Below are the SQL code for both my queries :
Query 1 :
Code:
SELECT Format([EnquiryRec],"mmmm") AS [Month], Format([EnquiryRec],"yyyy") AS 2008, Count(tblTrack.EnquiryRec) AS CountOfEnquiryRec
FROM tblTrack
GROUP BY Format([EnquiryRec],"mmmm"), Format([EnquiryRec],"yyyy"), Month([EnquiryRec])
HAVING (((Format([EnquiryRec],"yyyy"))='2008'))
ORDER BY Month([EnquiryRec]);
Code:
SELECT Format([EnquiryRec],"mmmm") AS [Month], Format([EnquiryRec],"yyyy") AS 2009, Count(tblTrack.EnquiryRec) AS CountOfEnquiryRec
FROM tblTrack
GROUP BY Format([EnquiryRec],"mmmm"), Format([EnquiryRec],"yyyy"), Month([EnquiryRec])
HAVING (((Format([EnquiryRec],"yyyy"))='2009'))
ORDER BY Month([EnquiryRec]);