
if you want to make your query look more spectacular, you could go for a join with the same table of course. But Lieven's suggestion should just work, so i don't really see why you would do that, except maybe to impress the ladies :D On Fri, 02 Jul 2010 10:29:44 +0200, Lieven Sterck <lieven.sterck@psb.vib-ugent.be> wrote:
SELECT DISTINCT name, score FROM .....
djebus, even I know that !! 8-)
On 02/07/2010 10:23, Frederik Delaere wrote:
lets say I have this data
id name score 1 dude1 9.1 2 dude2 9.5 3 dudette1 9.0 4 dude1 9.3 5 dudette1 8.5
And I want to select highest 3 scores:
SELECT score FROM table ORDER BY score DESC LIMIT 0,3
result will be
9.5 9.3 9.1
but how can I select both the name and the score and I only want one score per person
I can do: SELECT DISTINCT name FROM table ORDER BY score DESC LIMIT 0,3 this will give me the correct names in the correct order, but I want their score also
is this possible in one query ?
thanksuwel !