ORACLE 中sql语句问题

来源:百度知道 编辑:UC知道 时间:2024/07/02 10:15:49
我在SQL*PLUS中建了如下两个表:
表一:student1:

ID NAME AREA CLASS
--- ---------------------- ------------------- ----------
1 zhoujie west 11
2 taoyuan west 12
3 zhangsan east 13
4 lisi east 13
表二:student2:
NUM NAME PAY
----- --------- ----------
1 zhoujie 1000
2 taoyuan 1100
3 zhangsan 800

现在要查询所有在area=west地区人员的PAY,
select name,pay from student2 where name in
(select name from student1 where area='west');
SQL*PLUS结果却显示为:未选定行。
是哪里写错了啊?请高手斧正;

create table temp_taoj_0122_A(id varchar2(4),name varchar2(20),area varchar2(20),class varchar2(4))
create table temp_taoj_0122_B(num varchar2(4),name varchar2(20),pay varchar2(10))

insert into temp_taoj_0122_A values('1','zhoujie','west','11')
insert into temp_taoj_0122_A values('2','taoyuan','west','12')
insert into temp_taoj_0122_A values('3','zhangsan','east','13');
insert into temp_taoj_0122_A values('4','lisi','east','13')

insert into temp_taoj_0122_B values('1','zhoujie','1000');
insert into temp_taoj_0122_B values('2','taoyuan','1100');
insert into temp_taoj_0122_B values('3','zhangsan','800')

select name,pay from temp_taoj_0122_B where name in
(select name from temp_taoj_0122_A where area='west');