1.
select score from student_1 group by score having count(*) = 2
select score from student_1 group by score having count(*) = 2
解决方案 »
- 我的这段代码总报错,请各位关注一下
- struts jsp文件中的Javascript如何使用?
- 有没有必要把网站后台也做成静态页面的
- Linux下Tomcat5关闭问题
- JIRA相关问题.........
- 关于HttpClient下的Cookie问题
- java.lang.NumberFormatException: For input string: "net.entity.Users@23b5c3"
- 在Java窗体上如何才能将数据库中的内容按条件生成报表并打印出来,即如何使用打印功能。
- 在线等待,weblogic+jbuilder问题!绝对有难度!!!
- 我想用Boolean保存3种状态,不知可不可行?
- 修女重出江湖
- gms如何去监控 设备线路的状况?
第二题没有别的表和teachid关联怎么查到老师的名字啊,疑惑
第3题不会
create table student_2(
id int,
teacherid int,
student varchar(5),
score int
)
insert into student_2
select 1,1,'张三',90 union all
select 2,2,'李四',80 union all
select 3,3,'王五',85 union all
select 4,1,'赵六',70goselect id,(case teacherid
when 1 then '王老师'
when 2 then '李老师'
when 3 then '赵老师'
else '' end) 教师姓名,student,score from student_2godrop table student_2
写成count(*)>1会比较好吧
select score from student_1 group by score
2,
select id,
老师姓名=case teacherid
when 1 then '王老师'
when 2 then '李老师'
when 3 then '赵老师'
else '' end ,
student,score from student_2