in reply to Can this be done entirely in MySQL?
If your rows are numbered, you can do this:
select floor(regno/100) "groupby", min(regno),max(regno),min(name),max +(name) from registrations group by `groupby`;
But I presume they're not, in which case you have to roll it on the fly (and I hope you're using 4.1 or better, or the subselect will come crashing down):
set @rownum := 0; select floor(@rownum := @rownum + 0.01) "set_num", min(lname),max(lna +me) from (select * from registrants order by lname) reg group by "set_num";
Then of course you do the paged query using LIMIT $set_num*100, 100, which is of course subject to quirks if somebody named Jones registers when you're about to look at the page that used to start with Kerrigan, but that's a separate issue. :-)
Hope this helps!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can this be done entirely in MySQL?
by gam3 (Curate) on Apr 22, 2005 at 03:22 UTC |