Hi Rich, 

Use the LIMIT 2 and sort the SELECT with ORDER BY family ID DESC

//
Jonny



> -----Ursprungligt meddelande-----
> Från: R.Dobson [SMTP:[EMAIL PROTECTED]]
> Skickat:      den 21 maj 2002 14:57
> Till: [EMAIL PROTECTED]
> Ämne: returning top two values
> 
> Hi,
> I have a table containing data on a number of families.
> 
> I want to retrieve members of each family that have the two highest 
> scoring values for a column. i.e the max and second max.
> Is there a function similar to max() or greatest() that will return the 
> top 2 values when grouping by family ID?
> 
> I can do this using perl in about three steps but would rather make life 
> easier for myself if I can.
> 
> Thanks in advance
> Rich
> 
> mysql query
> 
> 
> ---------------------------------------------------------------------
> 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

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