34,837
社区成员




如果每个表都是一一关联的.
select a.* , b.* , c.* , d.* , f.*
from a,b,c,d,e
where a.id = b.id and a.id = c.id and a.id = d.id and a.id = e.id
如果不是一一关联呢,同时多个字段关联
如 a.id =b.id
and a.name= b.name
ang a.number = b. number
这只是两张表的关联,其他表也差不多是这样的!!!
----------
可对每个表先group by 分组,然后再关联.
如A(id , val)
B(id , aid , val)
select a.* , m.* from a,
(select t.* from B t where id = (select max(id) from B where aid = t.aid)) m
where a.id = m.aid