本文介绍了仅按连接表最大值选择行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想为 u.classno、u.userno 选择具有最大 b.enddate 的行.但它不起作用.
I want to select only the row which has max b.enddate for u.classno, u.userno. But it doesn't work.
select u.classno, u.userno, b.enddate from libUser u join book b on b.id = u.bookid group by u.classno, u.userno having b.enddate=max(b.enddate) //doesn't works 推荐答案有什么问题:
select u.classno, u.userno, MAX(b.enddate) from libUser u join book b on b.id = u.bookid group by u.classno, u.userno更多推荐
仅按连接表最大值选择行
发布评论