小弟对数据库不精啊,只会简单的查询,
现在我需要把四张表的数据全部取出来应该怎么写语句啊?
表结构不同,也就是4张不同的表。

解决方案 »

  1.   

    select * from a,b,c,d
    where a.id=b.id
    and a.id=c.id
    and a.id=d.id
      

  2.   


    有无关系
    有  关联字段 left join on 。
    无  
    select * from TB1
    select * from TB2
    select * from TB3
    select * from TB4
      

  3.   

    关联字段是,表1,2,4有相同的关联字段pid,表3,4有相同的关联字段 jid
      

  4.   


    select * 
    from t1
    left join t2 on t1.pid=t2.pid
    left join t3 on t1.pid=t3.pid
    left join t4 on t3.jid=t4.jid