Reputation: 2412
I have a dataset:
variable value zip interval score
a 10 10017 10 8
a 10 10017 10 10
a 10 10017 11 12
a 10 10017 11 8
a 10 10018 10 8
a 10 10018 10 10
a 10 10018 11 12
a 10 10018 11 8
b 10 10017 10 11
b 10 10017 10 8
b 10 10017 11 9
b 10 10017 11 8
I need to find MAX of score using Oracle SQL while taking the following into consideration:
The output of above should be:
variable value zip interval score
a 10 10017 10 10
a 10 10017 11 12
a 10 10018 10 10
a 10 10018 11 12
b 10 10017 10 11
b 10 10017 11 9
Upvotes: 0
Views: 79
Reputation: 25753
Try this:
select variable,value,zip,interval, max(score)
from tab
group by variable,value,zip,interval
Upvotes: 1
Reputation: 2091
This query should do the trick for you.
SELECT variable, value, zip, interval, max(score) score
FROM myTable
GROUP BY variable, value, zip, interval;
Upvotes: 0
Reputation: 2200
Try this
select variable,value,zip,interval,max(score)
from tab
group by variable,value,zip,interval
Upvotes: 0