inner join 多表查询

三表以及三表以上联合查询:

select table1.ziduan1,table2.ziduan,2,table3,ziduan3
from table1 inner join table2 
on table1.field1 = table2.field1 
inner join table3 
on table1.field1 = table3.field1

 举例: 

select clFile.FILEPATH,clPerson.personcode,cailiao.clcode 
    from clFile inner join clPerson 
    on clFile.PGUID = clPerson.MGUID
    inner join cailiao 
    on clPerson.MGUID = cailiao.clGuid";

俩表联合查询:

select * FROM 
    表1 INNER JOIN 表2 
    ON 表1.字段号=表2.字段号

 举例:

select * from CaiLiao inner 
    join clCode 
    on CaiLiao.clCode=clCode.code 
    where CaiLiao.clGUID 
    in (select mGUID from clPerson where pcode = '123' )                  

  

posted on 2017-09-22 21:26  宋兰君  阅读(347)  评论(0编辑  收藏  举报

导航