Re: Re: Ranks and ties (more)

From: Date: Thu, 22 Jun 2000 01:01:07 +0000
Subject: Re: Re: Ranks and ties (more)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-2559@lists.php.net to get a copy of this message
On 21 Jun, Melissa Tonelli wrote: > > At 01:53 PM 6/21/00 +0930, David Robley wrote: > >>Very much off the top of my head and untested, but essentially what you >>need is to check if the current employee number is the same as the >>klast; if so they share the same ranking. And you presumably want the >>rankings to skip if there are 'equals' so you get something like: > > > Hey, David, thanks. This works quite well, but now I want more (it's human > nature). > > If I want to display only the "top 25" how do I tell my script where to > draw the cutoff? I can't use LIMIT in the query, because if there happens > to be a tie in the top 25 then I'll come up short on my list -- displaying > 25 companies, but showing only those ranked 1-24! > > See, the trouble is, I don't want to have to maintain a RANKS column in my > db. Maybe there's a way to do this with a function in MySQL? > > Any more hints/suggestions would be appreciated! > Well, how about limiting the loop by the counter; ie when counter = $TOP_NUM then exit from the loop that's displaying the DB results. Cheers -- David Robley | WEBMASTER & Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet | http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA

« previous php.general (#2559) next »