扫二维码与项目经理沟通
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流
select class,total,name from (select *,ywsc+sxsc as total from st ORDER BY total DESC) b
创新互联是一家专注于网站设计制作、成都做网站与策划设计,章贡网站建设哪家好?创新互联做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:章贡等地区。章贡做网站价格咨询:18982081108
where
not EXISTS(select * from (select *,ywsc+sxsc as total from st ORDER BY total DESC) c where c.class=b.class and b.total c.total GROUP BY c.class HAVING COUNT(*)2 )
ORDER BY b.class,b.total DESC
SELECT * FROM 表 LIMIT 0, 3LIMIT 接受一个或两个数2113字参数。参数必须是5261一个整数常量。如果给定4102两个参数,第一1653个参数指定第一个返回记录行的偏移量,第二个参数指定返回记录行的最大数目。初始记录行的偏移量是 0(而不是 1)
select scrname,stucount from scrtab
select top 3 scrname,stucount from scrtab order by stucount
先按人数排序,然后在查出前三个
sql server查询前n条记录:
因为id可能不是连续的,所以不能用取得10
上面那条答案应该是可以的啊,可能是看起来复杂了点吧,我自己试过是没问题的:
SELECT t1.sno,t1.cno,Score
FROM SC t1
WHERE EXISTS
(SELECT COUNT(1)
FROM SC
WHERE t1.cno= cno AND t1.scorescore
HAVING COUNT(1)3)
ORDER BY t1.cno,score DESC
另外还有一种类似的写法:
SELECT t1.sno,t1.cno,Score
FROM SC t1
WHERE
(SELECT COUNT(cno)
FROM SC
WHERE t1.cno= cno AND t1.scorescore)3
ORDER BY t1.cno,score DESC
我们在微信上24小时期待你的声音
解答本文疑问/技术咨询/运营咨询/技术建议/互联网交流