I'm trying to optimize the following query:
SELECT class.ID, class.name, values.number
from class, values
where class.ID=values.ID
order by values.number DESC
This gives me something like this (really much more rows than are shown)
14 John 96
4 Chris 95
13 Jeff 95
17 Susan 93
14 John 92
4 Susan 90
15 Mary 90
13 Jeff 88
What I would like is one unique value but the highest for each ID. I've tried many variations, but have not been able to get the following:
14 John 96
4 Chris 95
13 Jeff 95
17 Susan 93
15 Mary 90
How can I do it in MySQL?
rj
SELECT class.ID, class.name, values.number
from class, values
where class.ID=values.ID
order by values.number DESC
This gives me something like this (really much more rows than are shown)
14 John 96
4 Chris 95
13 Jeff 95
17 Susan 93
14 John 92
4 Susan 90
15 Mary 90
13 Jeff 88
What I would like is one unique value but the highest for each ID. I've tried many variations, but have not been able to get the following:
14 John 96
4 Chris 95
13 Jeff 95
17 Susan 93
15 Mary 90
How can I do it in MySQL?
rj