一、LEFT JOIN 左连接查询
select a.CREATEDATE,b.DESCRIPTION,c.DESCRIPTION from STATIONATTENDANCE a
left join MGS_PARAMETERS b on a.EMPLOYEEID=b.rowid
left join MGS_PARAMETERS c on a.SITEID=c.rowid
二、子查询
select a.CREATEDATE,
use1r=(select DESCRIPTION from MGS_PARAMETERS where rowid=a.EMPLOYEEID),
site1=(select DESCRIPTION from MGS_PARAMETERS where rowid=a.SITEID)
from STATIONATTENDANCE a
select a.CREATEDATE,
(select DESCRIPTION from MGS_PARAMETERS where rowid=a.EMPLOYEEID),
(select DESCRIPTION from MGS_PARAMETERS where rowid=a.SITEID)
from STATIONATTENDANCE a
子查询的可读性强,更好写;对于大数据库来讲,左连接查询则效率更高。