Re: [SQL ] 请问 103年软件设计竞赛题目

楼主: tracy217 (T大)   2015-07-18 14:23:24
※ 引述《s900362123 (s900362123)》之铭言:
: 内容/问题描述:
: 请找出'groupB'参赛队伍的答题中没有任一小题为0分的队伍,列出队伍编号。显示结果
: 采用队伍编号由小而大排序显示,且同一队伍编号不重复显示。
: 资料结构 :
: item_score
: groupname 可变长度字串(长度为10) –参赛组别, 分成’groupA’及’groupB’
: teamno 可变长度字串(长度为8) –队伍编号
: pnum 整数(长度为2) – 题号, 默认值为0
: score 整数(长度为4) – 该题得分, 默认值为0
: 其中group、teamno 和pnum合起来为主键(primary key)。
: 这是我写的
: select a.groupname,a.teamno,a.pnum,a.score from
: (select * from item_score where groupname="groupB" and score<>0)a,
: (select * from item_score where groupname="groupB" and score=0 group by
: teamno)b
: where a.teamno <> b.teamno
: group by teamno
: 我先找出B所有的分数,再找出B 分数=0的资料 然后group by teamno
: 条件所有的teamno不等于 B分数=0的teamno
: 但是结果还是有=0的 teamno

Links booklink

Contact Us: admin [ a t ] ucptt.com