查看一些特定sql需求的书写

user表,5个人abcde,  content表10篇文章,一个人对应两篇文章,有 time字段,查询出五个人的最新文章。

select a.id,a.SName,a.ClsNo,a.Score
from Table1 a left join Table1 b on a.ClsNo=b.ClsNo and a.Score<b.Score
group by a.id,a.SName,a.ClsNo,a.Score
having count(b.id)<2
order by a.ClsNo,a.Score desc

SELECT a.id ,b.content FROM table1 a LEFT JOIN content b ON a.id = b.uid GROUP BY a.id ORDER BY b.time
上一篇:HDU-1036 Average is not Fast Enough!


下一篇:【Google Play】创建 Google 开发者账号 ( 注册邮箱账号 | 创建开发者账号 )(三)