G
Guest
I have to table thats contains survey data for a year, every quarter of the
year we recieve new data. I have it set up so that the data runs through
queries to get some averages and totals. I am trying to set up a query, to
take the last three quarters of data after every new quarter. For Ex. I have
the numbers 1, 2, 3, 4, 5 ,6. I want the query to show the data for quarters
4, 5, 6 but when I insert quarter 7 data the query should pull up 5, 6, 7.
Here's the SQL Code I have to try and pull the last three numbers, but it
stills just gives me all the quarters
SELECT a.[Quarter]
FROM tblQuarterlySurveyData a
WHERE EXISTS
( SELECT Max(b.[Quarter]), Max(b.[Quarter]), Max(b.[Quarter])
FROM tblQuarterlySurveyData b
WHERE b.[Quarter] = a.[Quarter]);
Any help would be great. Thanks
year we recieve new data. I have it set up so that the data runs through
queries to get some averages and totals. I am trying to set up a query, to
take the last three quarters of data after every new quarter. For Ex. I have
the numbers 1, 2, 3, 4, 5 ,6. I want the query to show the data for quarters
4, 5, 6 but when I insert quarter 7 data the query should pull up 5, 6, 7.
Here's the SQL Code I have to try and pull the last three numbers, but it
stills just gives me all the quarters
SELECT a.[Quarter]
FROM tblQuarterlySurveyData a
WHERE EXISTS
( SELECT Max(b.[Quarter]), Max(b.[Quarter]), Max(b.[Quarter])
FROM tblQuarterlySurveyData b
WHERE b.[Quarter] = a.[Quarter]);
Any help would be great. Thanks