On Monday 04 March 2002 10:50 am, Richard Clarke wrote: > > create table mytable (id int, val char(255), hits int); > insert some data... > > select max(5,hits) from mytable group by id; > > This would allow selecting of the top 5 rows for each id according to the > hit column. > > Without this function it means the code must be written manually as, > foreach(id) { > select * from mytable where id='$id' order by hits desc limit 5 > }
Why would you do your select like that instead of: select * from mytable order by hits desc limit 5 ? And for the spam filter: mysql, microsoft sucks, nusphere lawsuit. :) --------------------------------------------------------------------- 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