关于查询在2000年3月4日那天到达哥本哈根的用户名,总共有四个表,需要从这四个表里面查询,都在sasuser逻辑库里面,所以大家应该都有,就不列出来了,程序如下面:
proc sql;
select distinct e.firstname, e.lastname
from sasuser.flightschedule as a,
sasuser.staffmaster as b,
sasuser.payrollmaster as c,
sasuser.supervisors as d,
sasuser.staffmaster as e
where a.date=’04mar2000’d and
a.destination=’CPH’ and
a.empid=b.empid and
a.empid=c.empid and
d.jobcategory=substr(c.jobcode,1,2)
and d.state=b.state
and d.empid=e.empid;
quit;
我想知道的是为什么第二个表要再命名一次,如果我把这个去掉之后,并稍微修改一下,换成如下程序:
proc sql;
select distinct b.firstname, b.lastname
from sasuser.flightschedule as a,
sasuser.staffmaster as b,
sasuser.payrollmaster as c,
sasuser.supervisors as d
where a.date='04mar2000'd and
a.destination='CPH' and
a.empid=b.empid and
b.empid=c.empid and
d.jobcategory=substr(c.jobcode,1,2)
and b.state=d.state;
quit;
结果得到的数据跟第一个程序所得到的的结果不一样,请教一下这个为什么呢?