Correct. Richard
----- Original Message ----- From: "DL Neil" <[EMAIL PROTECTED]> To: "Richard Clarke" <[EMAIL PROTECTED]>; "Christopher Thompson" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, March 04, 2002 6:34 PM Subject: Re: extra max() function possibly very useful? > LIMIT to be applied to each group result, instead of to the final > resultset. > Correct? > =dn > > > > Because that wouldn't give the correct results. > > I want the top 5 rows for EACH id. > ... > > select distinct cid from mytable; > > foreach(cid) { > > select * from mytable where cid='$cid' order by hits desc limit 2; > > } > > > > Which means the table is reread over and over. With this extra > function we > > could reduce the reads to at best once. > SQL --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php