请教一个关于多表联合查询的问题
情况是这样:
现在有,t1 ,t2 ,t3,t4.....t10
一共10张表
他们的连接条件是:
t1.xxx = t2.xxx
t2.aaa = t4.aaa
t5.ooo = t10.ooo
....
过滤条件是
t1.id = 100
t2.date < 201004
....
这样的需求应该怎么写呢?
我之前写的是
select * from t1
join t2
join t3
...
on t1.xxx = t2.xx
...
where t1.id = 100
...
这样好像不对,请教下,如果遇到大于2张表的联合查询,应该怎么写?
------解决方案--------------------select* from(两张表联合查询的结果)inner join **on**
------解决方案--------------------
1、直接=连接
select * from t1 ,t2 ,t3,t4.....t10 where
t1.xxx = t2.xxx
t2.aaa = t4.aaa
t5.ooo = t10.ooo
.....;
2、join
select * from t1
join t2 on (t1.xxx = t2.xxx) join t3 on (1=1) join t4 on (t2=t4) join ....;
------解决方案--------------------