Hi,

What would the plausability of a function like this being implemented in the
future.

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
}

which is obviously quite inefficient where the domain of id becomes large.

Any input from the developers about the possibility of this functionality
would be much appreciated.

Richard

p.s. here is the word mysql to get past the intelligent spam filter.


---------------------------------------------------------------------
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

Reply via email to