Hi,
R> Alternatively, you can compute your order statistic explicitly by joining
R> the table against itself, and then filter based on that:

        Why did you use max(curEntry.family) and max(curEntry.member) ? I
tried the query w/out max, and it works just the same.
        The following question is: how did you managed to write this
query? I'm a newbie, and only after I write the whole sequence down, I
succeeded in understanding how it works, but I couldn't understand what
stands behind it. Is there a place on the Internet where I can find some
documents to help my skills in writing complicated queries ? 

R> select max(curEntry.family) as family,max(curEntry.member) as
R> member,max(curEntry.score),count(*) as orderstatistic
R> from theTable as curEntry, theTable as greaterEntries
R> where curEntry.family = greaterEntries.family and curEntry.score <=
R> greaterEntries.score
R> group by curEntry.family, curEntry.member
R> having orderstatistic < 3
R> order by family, orderstatistic;





-- 
 Ciprian

> Ambition is a poor excuse for not having enough sense to be lazy.


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