W
WANNABE
I'm sure this is an easy question for someone out there, and I used to be able
to do this..
I have 2 queries that produce the results I need, but I would like to remember
how to do it with a sub-query.
My 2 queries are below, and the results are a list of distinct records. The
newest of the last 2 years, one record per country.
I would greatly appreciate any assistance, Thank you very much.
SELECT [Country Profile].COUNTRY, [Country Profile].Period, [Country
Profile].LQR, [Country Profile].[MLT DEBT], [Country Profile].[MST DEBT],
[Country Profile].[SPLT DEBT], [Country Profile].[FLT DEBT], [Country
Profile].[Country Limit]
FROM [Country Profile], [qq_CountryLimits_Last2Yrs t2]
WHERE ((([Country Profile].COUNTRY)=[qq_CountryLimits_Last2Yrs t2].[country])
AND (([Country Profile].Period)=[qq_CountryLimits_Last2Yrs t2].[maxofperiod]))
ORDER BY [Country Profile].COUNTRY, [Country Profile].Period;
***qq_CountryLimits_Last2Yrs t2****
SELECT [Country Profile].COUNTRY, Max([Country Profile].Period) AS MaxOfPeriod
FROM [Country Profile]
GROUP BY [Country Profile].COUNTRY
HAVING (((Max([Country Profile].Period))=Year(Now()) Or (Max([Country
Profile].Period))=Year(Now())-1))
ORDER BY [Country Profile].COUNTRY, Max([Country Profile].Period);
to do this..
I have 2 queries that produce the results I need, but I would like to remember
how to do it with a sub-query.
My 2 queries are below, and the results are a list of distinct records. The
newest of the last 2 years, one record per country.
I would greatly appreciate any assistance, Thank you very much.
SELECT [Country Profile].COUNTRY, [Country Profile].Period, [Country
Profile].LQR, [Country Profile].[MLT DEBT], [Country Profile].[MST DEBT],
[Country Profile].[SPLT DEBT], [Country Profile].[FLT DEBT], [Country
Profile].[Country Limit]
FROM [Country Profile], [qq_CountryLimits_Last2Yrs t2]
WHERE ((([Country Profile].COUNTRY)=[qq_CountryLimits_Last2Yrs t2].[country])
AND (([Country Profile].Period)=[qq_CountryLimits_Last2Yrs t2].[maxofperiod]))
ORDER BY [Country Profile].COUNTRY, [Country Profile].Period;
***qq_CountryLimits_Last2Yrs t2****
SELECT [Country Profile].COUNTRY, Max([Country Profile].Period) AS MaxOfPeriod
FROM [Country Profile]
GROUP BY [Country Profile].COUNTRY
HAVING (((Max([Country Profile].Period))=Year(Now()) Or (Max([Country
Profile].Period))=Year(Now())-1))
ORDER BY [Country Profile].COUNTRY, Max([Country Profile].Period);