|
Hi there
i did what was suggested. However i need to do this at 2 levels:
1) between RID and Year
2) between Year and Quarter
This is to select the minimum year for that Region_id
SELECT vendorquery.Region_ID, Min(vendorquery.Year) AS MinOfYear
FROM vendorquery
GROUP BY vendorquery.Region_ID;
and this is to select the min quarter for that Year
SELECT vendorquery.Year, Min(vendorquery.Quarter) AS MinOfQuarter
FROM vendorquery
GROUP BY vendorquery.Year;
I tried to combine them
SELECT vendorquery.Region_ID, Min(vendorquery.Year) AS MinOfYear, Quarter
FROM vendorquery
where Quarter=(SELECT vendorquery.Year, Min(vendorquery.Quarter) AS MinOfQuarter
FROM vendorquery
)
GROUP BY vendorquery.Region_ID;
the error given by MS Access is:
"You have written a subquery that can return more than one field without using "exists" in the main query "from" clause
I am really new in SQL and will appreciate any help.
|