>I only need 4 rows returned to me and not all 11 no
>matter what the <= XXXXXXX part of the where is.
... LIMIT BY 0, 4?
Jay Paulson (CE CEN) wrote:
My query below returns however many rows fit the WHERE condition, in this case when they year, period, week is <= 2009131. In my case it is returning 11 rows because I have 11 rows where the year,period, week is 2006XXX. However, this is not what I want. I only need 4 rows returned to me and not all 11 no matter what the <= XXXXXXX part of the where is.
I guess my question becomes is it possible to put a LIMIT of how many rows are returned on a GROUP BY?
SELECT ROUND(AVG(page_hit)) as page_hit, ROUND(AVG(training_tracking)) as training_tracking, ROUND(AVG(certificates)) as certificates, ROUND(AVG(team_members)) as team_members, ROUND(AVG(evaluation)) as evaluation, CONCAT(year,period,week) as date
WHERE CONCAT(year,period,week) <= 2009131 AND region_id != 'AA'
GROUP BY date
ORDER BY date DESC LIMIT 0,77
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.14.8/215 - Release Date: 12/27/2005