Hey guys.  I'm kind of revisiting something I asked about before.  I 
have a high scores table, and a table of friends, and I wish to select 
for user x:

The score of x
The scores of all of x's friends

Ordered by score descending.

I am using this:

SELECT * FROM (SELECT * FROM cupPlayTable WHERE upper(name) = 
upper('Ian') AND missionId = upper('aa1') union all SELECT a.* FROM 
cupPlayTable a, friendTable b WHERE upper(b.player) = upper('Ian') AND 
upper(b.friend) = upper(a.name) AND missionId = upper('aa1')) ORDER BY 
score DESC

This works, although I would appreciate any critique on it.

I also want to add selecting the highest score, and adding it to the 
results assuming it isn't already in there (ie unless it happens your or 
a friends' score is the highest).  Could anyone advise me on how best to 
do that?

Thanks,
Ian
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to