From: Peter Brawley Date: October 4 2007 2:19pm Subject: Re: LIMIT within GROUP BY List-Archive: http://lists.mysql.com/mysql/209395 Message-Id: <4704F66A.1010901@earthlink.net> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="------------040301070301030308000309" --------------040301070301030308000309 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Miroslav >My goal is to sum 7 greatest results for each person. Have a look at 'Within-group quotas (Top N per group)' at http://www.artfulsoftware.com/infotree/queries.php. PB ----- Miroslav Monkevic wrote: > Hello, > > MySQL 4.1 > > I have query: > SELECT SUM(points) as ranking FROM results GROUP BY person_id ORDER BY > ranking DESC > > My goal is to sum 7 greatest results for each person. > > In more general, my question is: is there a way to limit number of > records within groups in "group by" query. > > Thank you! > > --------------040301070301030308000309--