Situation: Select for vendors who (1) had PO activity in 2006 or (2) vendor record created in 2006.
So far my technique has been to create a Totals query (design view) to get the last PO date and then use that query in another to get the desired records. Here are the SQL Views of the queries:
#1 Query: qryLastPODate
SELECT POHEADER.POHVCODE, Max(POHEADER.POHORDDATE) AS MaxOfPOHORDDATE
FROM POHEADER
GROUP BY POHEADER.POHVCODE;
#2 Query: qryReportData
SELECT VENDOR.VNCODE, VENDOR.VNNAME, qryLastPODate.MaxOfPOHORDDATE, VENDOR.VNTYPE
FROM VENDOR INNER JOIN qryLastPODate ON VENDOR.VNCODE = qryLastPODate.POHVCODE
WHERE (((qryLastPODate.MaxOfPOHORDDATE)>="1/1/2005") AND ((VENDOR.VNTYPE)="A"));
It's time for me to go to a new level. How can these be combined into one query statement?
So far my technique has been to create a Totals query (design view) to get the last PO date and then use that query in another to get the desired records. Here are the SQL Views of the queries:
#1 Query: qryLastPODate
SELECT POHEADER.POHVCODE, Max(POHEADER.POHORDDATE) AS MaxOfPOHORDDATE
FROM POHEADER
GROUP BY POHEADER.POHVCODE;
#2 Query: qryReportData
SELECT VENDOR.VNCODE, VENDOR.VNNAME, qryLastPODate.MaxOfPOHORDDATE, VENDOR.VNTYPE
FROM VENDOR INNER JOIN qryLastPODate ON VENDOR.VNCODE = qryLastPODate.POHVCODE
WHERE (((qryLastPODate.MaxOfPOHORDDATE)>="1/1/2005") AND ((VENDOR.VNTYPE)="A"));
It's time for me to go to a new level. How can these be combined into one query statement?