select 学号 from 表2 a where 代号='001' and 代号 in (select 代号 from 表2 where 代号='002')
select 学号 from (select * from where 代号='002') as a, as b where b.代号='001' and a.学号=b.学号
select 学号 from as A, as B where A.学号=B.学号 and A.代号='001' and B.代号='002'
select 学号 from where 代号='001' and 代号 in (select 代号 from where 代号='002') 不行啊我表中确实有同时选001 和 002的学生但是运行没有顺任何结果这个嵌套是不是错了啊
select 学号 from (select * from where 代号='002') as a, as b where b.代号='001' and a.学号=b.学号棋哥 这个好像也不行呃 他说学号列名不明确。。
select distinct 学号 from where 代号 in (select 代号 from suject where 课程名 in ('001','002'))--or select distinct 学号 from a join (select 代号 from suject where 课程名 in ('001','002') b on a.代号=b.代号
select 学号 from (select 学号 from where 代号='001') as a, (select 学号 from where 代号='002') as b where a.学号=b.学号 select 学号 from (select * from where 代号='002') as a, as b where b.代号='001' and a.学号=b.学号 两种写法都提示 学号列名无效
select a.学号 from a, b where a.学号=b.学号 and a.代号='001' and b.代号='002'
select a.学号 from (select 学号 from where 代号 in('001'))a join (select 学号 from where 代号 in('002'))b on a.学号=b.学号这个一定可以。
select a.学号 from a join (select 学号 from where 代号 ='001')b on a.学号=b.学号 where a.代号='002'这个应该也可以的。
select 学号
from 表2 a
where 代号='001' and 代号 in (select 代号 from 表2 where 代号='002')
from as A, as B
where A.学号=B.学号 and
A.代号='001' and
B.代号='002'
from
where 代号='001' and 代号 in (select 代号 from where 代号='002')
不行啊我表中确实有同时选001 和 002的学生但是运行没有顺任何结果这个嵌套是不是错了啊
这个好像也不行呃
他说学号列名不明确。。
select distinct 学号 from a join (select 代号 from suject where 课程名 in ('001','002') b on a.代号=b.代号
(select 学号 from where 代号='001') as a,
(select 学号 from where 代号='002') as b
where a.学号=b.学号
select 学号 from (select * from where 代号='002') as a, as b where b.代号='001' and a.学号=b.学号
两种写法都提示
学号列名无效
where a.学号=b.学号 and a.代号='001' and b.代号='002'
from (select 学号 from where 代号 in('001'))a join (select 学号 from where 代号 in('002'))b on a.学号=b.学号这个一定可以。
on a.学号=b.学号
where a.代号='002'这个应该也可以的。