Re: [SQL ] 請問 103年軟體設計競賽題目
※ 引述《s900362123 (s900362123)》之銘言:
: 內容/問題描述:
: 請找出'groupB'參賽隊伍的答題中沒有任一小題為0分的隊伍,列出隊伍編號。顯示結果
: 採用隊伍編號由小而大排序顯示,且同一隊伍編號不重複顯示。
: 資料結構 :
: item_score
: groupname 可變長度字串(長度為10) –參賽組別, 分成’groupA’及’groupB’
: teamno 可變長度字串(長度為8) –隊伍編號
: pnum 整數(長度為2) – 題號, 預設值為0
: score 整數(長度為4) – 該題得分, 預設值為0
: 其中group、teamno 和pnum合起來為主鍵(primary key)。
比較直觀的想法是找出有=0的隊伍,然後把所有隊伍減掉剛剛得出的結果就是了
ms sql
select distinct teamno from item_score where groupname='groupB'
and teamno not in(
select distinct teamno from item_score where score=0 and groupname='groupB'
)
order by teamno
--
The Sword of Truth series
written- by Terry GoodKind
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 115.43.104.85
※ 文章網址: https://www.ptt.cc/bbs/Database/M.1437189562.A.BFB.html
※ 編輯: tedcat (115.43.104.85), 07/18/2015 11:20:00
→
07/18 16:25, , 1F
07/18 16:25, 1F
→
07/18 16:26, , 2F
07/18 16:26, 2F
→
07/18 16:27, , 3F
07/18 16:27, 3F
→
07/18 16:27, , 4F
07/18 16:27, 4F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 3 之 5 篇):