Selecting multiple Max() values using a single SQL Statement - postgresql
I have a table that has data that looks something like this:
data_type, value
World of Warcraft, 500
Quake 3, 1500
Quake 3, 1400
World of Warcraft, 1200
Final Fantasy, 100
Final Fantasy, 500
What I want to do is select the maximum of each of these values in a
single statement. I know I can easily do something like
select data_type, max(value)
from table
where data_type = [insert each data type here for separate queries]
group by data_type
But what I want it to display is is
select data_type,
max(value) as 'World of Warcraft',
max(value) as 'Quake 3',
max(value) as 'Final Fantasy'
So I get the max value of each of these in a single statement. How would I
go about doing this?
No comments:
Post a Comment