本帖最后由 u014742080 于 2014-11-27 17:27:01 编辑

解决方案 »

  1.   

    在select中不要使用*使用select user.Doc_Name, informance.Doc_Name
      

  2.   

    select 
        user.doc_name,document.doc_name
    from
        user left join document
    on
        user.doc_id=document.uid
      

  3.   

    可是我需要user表join doc表,information_doc也要join doc表。需要怎么写呢~
      

  4.   


    这样只有user表的doc.id和doc.name,我还需要information_doc表的 doc.name。真心想不到怎么写.
      

  5.   


    Select user.*,information.*,information_doc.*,document.*  
    from user 
    left join doc 
    on user.Doc_ID = doc.UID
    left join information 
    on user.Information_ID = Information.UID
    left join information_doc 
    on information.UID= information_doc.Information_ID
    and information_doc.Doc_ID = doc.UID1、需要的字段尽量在select里自己写出来,我不知道你要那些字段,所以把各表所有字段都取出来了。
    2、join的条件可以多个,用and一个个拼上去就行。你因为连information_doc时有两个条件,你相同的doc表关联了两次导致sql出错。实际连一次doc表就足够。