This might help.

http://www.mysql.com/doc/en/example-Maximum-column-group-row.html

I had the same problem.  Before I found the webpage above, I went with a less 
efficient but simpler way.  I wanted the highest revision ("revision") for each news 
article ("id").  

$SQL = "CREATE TEMPORARY TABLE news_temp SELECT * FROM news ORDER BY revision DESC;";
$db->Execute($SQL);

// at this point, the results are in the temporary table,
// ordered JUST the way we like them :)  Now to pick 
// out the top one for each news id.

$SQL = "SELECT * FROM news_temp GROUP BY id ORDER BY id DESC;";
$result = $db->Execute($SQL);

Something like this might be what you're looking for.  I don't understand exactly how 
you want to order/choose students, but you might just need order by firm rank first, 
then time rank.

I hope that's of use.

-The Mindflayer
-- 
_______________________________________________
http://www.operamail.com
Now with OperaMail Premium for only US$29.99/yr

Powered by Outblaze

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