三表以及三表以上联合查询:
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' )