十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
select * from
十载的安多网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。成都营销网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整安多建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“安多网站设计”,“安多网站推广”以来,每个客户项目都认真落实执行。
(select Student.S#,Sname,Sage,Ssex,SC.C#,score,Cname
from SC inner join Student on SC.S#=Student.S#
inner join Course on Course.C#=SC.C#) as t
where exists(
select count(1) from t as d
where C#=d.C# and score d.score
having count(1)3
)
可以用row_number函数来解决。
1、创建测试表,插入数据:
create table sc
(id int,
name varchar(20),
class varchar(20),
score int);
insert into sc values (1,'badkano','一年一班',100)
insert into sc values (2,'百度知道团长','一年一班',99)
insert into sc values (3,'du小短','一年一班',95)
insert into sc values (4,'du小小动','一年一班',97)
insert into sc values (5,'du小智','一年一班',80)
insert into sc values (6,'吕布','一年二班',67)
insert into sc values (7,'赵云','一年二班',90)
insert into sc values (8,'典韦','一年二班',89)
insert into sc values (9,'关羽','一年二班',70)
insert into sc values (10,'马超','一年二班',98)
2、查询每个班级的前三名,可用语句:
select * from
(select row_number() over (partition by class order by score desc) 排名,* from sc) t
where 排名=3 order by class asc,score desc
Try this one,should be fine
下面这个已经有排序了哦,不行么?
SELECT uid, group_concat(subject)
FROM (SELECT id, uid, subject
FROM (SELECT id, uid, subject,
(SELECT COUNT(*)
FROM t_subject
WHERE uid = t.uid
AND subject = t.subject) RK
FROM t_subject t) t1
WHERE rk = 3) t2
GROUP BY uid
多了个a.原来
或者你直接用个substring()得了。。。