为了学习Hibernate,再来复习复习这个东东
LEFT OUTER JOIN 或者 LEFT JOIN 表示左外联接
RIGHT OUTER JOIN 或者 RIGHT JOIN 表示右外联接
FULL OUTER JOIN 或者 FULL JOIN 表示全联接
left join:在查询结果中包含join左侧表中的所有记录,以及join右侧表中匹配的记录。
right join:在查询结果中包含join右侧表中的所有记录,以及join左侧表中匹配的记
录。
full join:在查询结果中包含join两侧所有的匹配和不匹配的记录。(也就相当于left
join union right join的结果
inner join:在查询结果中仅返回符合on条件的列
多个表使用外连接:
select * from tablea as a left join tableb as b on a.id=b.id
right join tablec as c on a.id=c.id
delete a,b from tablea as a inner join tableb as b on a.id=b.id;
update tablea inner join tableb on tablea.id=tableb.id set tablea.adate=tableb.bdate ;
SELECT PPDMOBJECT.PUID, PPDMOBJECT.TIMESTAMP , PPDMOBJECT.POID, PPDMOBJECT.OWNINGSITEU, PPDMOBJECT.ISFROZEN, ppdmappobj.PARCHIVE_INFO, ppdmappobj.ROWNING_GROUPU, ppdmappobj.RLAST_MOD_USERU, ppdmappobj.ROWNING_USERU, ppdmappobj.PCREATION_DATE, ppdmappobj.PARCHIVE_DATE, ppdmappobj.PLAST_MOD_DATE, ppdmappobj.PBACKUP_DATE, pworkspaceobj.POBJECT_NAME, pworkspaceobj.POBJECT_DESC, pworkspaceobj.POBJECT_TYPE, pworkspaceobj.POBJECT_APPLICATION, pworkspaceobj.PREVISION_NUMBER, pworkspaceobj.PREVISION_LIMIT, pworkspaceobj.PDATE_RELEASED, pbomline.PARENTBVR FROM ppdmappobj INNER JOIN PPDMOBJECT ON ppdmappobj.PUID = PPDMOBJECT.PUID INNER JOIN pworkspaceobj ON ppdmappobj.PUID = pworkspaceobj.PUID INNER JOIN pbomline ON PPDMOBJECT.PUID = pbomline.PARENTBVR AND (pbomline.CHILDBV = 'LMxFeGa8SXUZVaK' OR pbomline.CHILDITEM = 'LMxFeGa8SXUZVaK' OR pbomline.PUID IN (SELECT PUID FROM PALTBOM WHERE PALTBOM.ALTPUID = 'LMxFeGa8SXUZVaK')) ORDER BY pworkspaceobj.POBJECT_NAME