Selecting multiple max() values using a single SQL statement

前端 未结 3 1263
梦谈多话
梦谈多话 2020-12-07 04:57

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
Fina         


        
3条回答
  •  余生分开走
    2020-12-07 05:21

    If you want your data to be aggregated in single string, go with bluefeet example, if you need a recordset with a record for each type:

    select
        data_type,
        max(value) as value
    from table1
    group by data_type
    

提交回复
热议问题