SQL MAX()函数 group by

SQL MAX()函数 group by,第1张

select 成绩.* from (select max(成绩) as 成绩,姓名from 成绩表 group by 姓名)

temp inner join 成绩表 on

temp.姓名=成绩表.姓名and temp.成绩=成绩表.成绩

SELECT *

FROM dbo.Data_Education

WHERE e_user in (SELECT e_user, max(e_diploma) as e_diploma FROM dbo.Data_Education group by e_user)

子查询SELECT e_user, max(e_diploma) as e_diploma FROM dbo.Data_Education group by e_user只能返回一列,可以改成

SELECT *

FROM dbo.Data_Education

WHERE e_user in (select e_user from (SELECT e_user, max(e_diploma) as e_diploma FROM dbo.Data_Education group by e_user))

select max(id) id, send_id, receiver_id

from messages

where receiver_id='3'

group by send_id, receiver_id

order by id desc

limit 0,10


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/11348236.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-15
下一篇 2023-05-15

发表评论

登录后才能评论

评论列表(0条)

保存