newbie2006
07-12-2007, 09:30 AM
Hi there
I am using MS Access and am trying to extract the region information from my vendorquery and find the earliest period and latest period for each. My raw data looks like (RID=regionID):
RID Year Quarter
1 1997 2
1 1998 2
1 1999 1
1 2006 1
2 1990 3
I have used the following sql:
SELECT Region_id, VendorQuery.Year AS BeginningYear
FROM VendorQuery
WHERE (((VendorQuery.Year)=(Select min(year) from vendorquery as subquery where subquery.year = vendorquery.year)));
I manage to get the region and beginning year using the above SQL but now i need to extend the query into "quarter" e.g. i should retrieve 1997 qtr 2 as my last record for region 1:
RID Year Quarter
1 1997 2
How do i do that?
I am using MS Access and am trying to extract the region information from my vendorquery and find the earliest period and latest period for each. My raw data looks like (RID=regionID):
RID Year Quarter
1 1997 2
1 1998 2
1 1999 1
1 2006 1
2 1990 3
I have used the following sql:
SELECT Region_id, VendorQuery.Year AS BeginningYear
FROM VendorQuery
WHERE (((VendorQuery.Year)=(Select min(year) from vendorquery as subquery where subquery.year = vendorquery.year)));
I manage to get the region and beginning year using the above SQL but now i need to extend the query into "quarter" e.g. i should retrieve 1997 qtr 2 as my last record for region 1:
RID Year Quarter
1 1997 2
How do i do that?