select * from
十載的安多網(wǎng)站建設(shè)經(jīng)驗(yàn),針對(duì)設(shè)計(jì)、前端、開發(fā)、售后、文案、推廣等六對(duì)一服務(wù),響應(yīng)快,48小時(shí)及時(shí)工作處理。成都營銷網(wǎng)站建設(shè)的優(yōu)勢(shì)是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動(dòng)調(diào)整安多建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計(jì),從而大程度地提升瀏覽體驗(yàn)。創(chuàng)新互聯(lián)從事“安多網(wǎng)站設(shè)計(jì)”,“安多網(wǎng)站推廣”以來,每個(gè)客戶項(xiàng)目都認(rèn)真落實(shí)執(zhí)行。
(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函數(shù)來解決。
1、創(chuàng)建測(cè)試表,插入數(shù)據(jù):
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,'百度知道團(tuán)長','一年一班',99)
insert into sc values (3,'du小短','一年一班',95)
insert into sc values (4,'du小小動(dòng)','一年一班',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,'關(guān)羽','一年二班',70)
insert into sc values (10,'馬超','一年二班',98)
2、查詢每個(gè)班級(jí)的前三名,可用語句:
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
下面這個(gè)已經(jīng)有排序了哦,不行么?
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
多了個(gè)a.原來
或者你直接用個(gè)substring()得了。。。