我分别执行了下列三个语句,第一个和第二个结果一样.可为什么第三个却和第二个不一样呢,按道理说应该得出一样的结果,为什么第三个还出现重复的答案呢?
select t_teacherno,t_courseno from teaching
结果:
t_teacherno t_courseno
2001050820 2005010001
2001050820 2005010002
2002040820 2005010003
2002040821 2005010004
select t1.t_teacherno,t2.t_courseno
from teaching as t1,teaching as t2
where t1.t_courseno=t2.t_courseno
order by t1.t_courseno
结果:
t_teacherno t_courseno
2001050820 2005010001
2001050820 2005010002
2002040820 2005010003
2002040821 2005010004
select t1.t_teacherno,t2.t_courseno
from teaching as t1,teaching as t2
where t1.t_teacherno=t2.t_teacherno
order by t1.t_teacherno
结果:
t_teacherno t_courseno
2001050820 2005010001
2001050820 2005010002
2001050820 2005010001
2001050820 2005010002
2002040820 2005010003
2002040821 2005010004
[求助]关于自身联结查询