MySQL select DISTINCT by highest value

后端 未结 5 567
刺人心
刺人心 2021-01-05 06:52

I have a table full of magazines, and need to extract the latest unique issue of each magazine.

Ive tried

    SELECT DISTINCT
    magazine
        F         


        
5条回答
  •  悲哀的现实
    2021-01-05 07:04

    SELECT id, MAX(onSale) as latest, magazine
    FROM product
    GROUP BY magazine
    ORDER BY latest DESC
    

提交回复
热议问题