select t1.c1,t2.c1... from t1,t2 where t1.p1=t2.p1
还有其他的联结方法 比如:外联结 左外联结: SELECT t1.Field1,t2.Field2 FROM t1 LEFT OUTER JOIN t2 ON t1.id = t2.id 这样如果t1.id在t2中没有,也能查到 右外联结 SELECT t1.Field1,t2.Field2 FROM t1 RIGHT OUTER JOIN t2 ON t1.id = t2.id 这样如果t2.id在t1中没有,也能查到 全外联结:是把左外联结和右外联结技术和在一起交叉联结:其实是笛卡尔乘积 SELECT t1.Field1,t2.Field2 FROM t1 CROSS JOIN t2
select * from tablei as a join table2 as b on a.id1=b.id join table3 as c on a.id2=c.id 或者是 select * from ((tablei as a join table2 as b on(a.id1=b.id)) join table3 as c on(a.id2=c.id))
比如:外联结
左外联结: SELECT t1.Field1,t2.Field2 FROM t1 LEFT OUTER JOIN t2
ON t1.id = t2.id
这样如果t1.id在t2中没有,也能查到
右外联结
SELECT t1.Field1,t2.Field2 FROM t1 RIGHT OUTER JOIN t2
ON t1.id = t2.id
这样如果t2.id在t1中没有,也能查到
全外联结:是把左外联结和右外联结技术和在一起交叉联结:其实是笛卡尔乘积
SELECT t1.Field1,t2.Field2 FROM t1 CROSS JOIN t2
join table3 as c on a.id2=c.id
或者是
select * from ((tablei as a join table2 as b on(a.id1=b.id))
join table3 as c on(a.id2=c.id))