SQL Query to get column values that correspond with MAX value of another column?

后端 未结 4 1955
天命终不由人
天命终不由人 2020-12-01 02:19

Ok, this is my query:

SELECT
  video_category,
  video_url,
  video_date,
  video_title,
  short_description,
  MAX(video_id) 
FROM
  videos
GROUP BY
  video         


        
4条回答
  •  臣服心动
    2020-12-01 03:17

    SELECT video_category,video_url,video_date,video_title,short_description,video_id FROM videos t1 where video_id in (SELECT max(video_id) FROM videos t2 WHERE t1.video_category=t2.video_category );

    Please provide your input and output records so that it can be understood properly and tested.

提交回复
热议问题