在SQL Server中,我加入了如下所示的三个表。在sql server中连接表?
select t1.empid, t2.sales, t3.date
from table1 t1
left outer join table2 t2 on t1.empid = t2.empid
left outer join table3 t3 on t1.empid = t2.empid
and t2.id= t3.id
这是正确的,我用and
的条件,谢谢。
,如果我写的PROC:我正在使用joing左外部表连接
select wrh.empid
from Tbl_F_Weekly_Report_Header WRH
left outer join Tbl_Emp_Master_M EM on wrh.EmpId =em.EmpId
LEFT outer join Tbl_F_Emp_Position_M EPS on WRH.PositionCode = EPS.PositionCode
where EM [Tbl_Emp_Master_M] doesnot contain Positioncode
是正确
我不明白你的'WHERE'条款。你能提供样本数据和预期结果吗? –
ya mr.adma wenger我不得不说的是在Tbl_emp_master_m我没有positioncode它不是在哪里条件。 –
谢谢你清理那个。您的查询是正确的。 –