with 建立臨時表
with t1 as (select * from employee),t3 as( select top 1 t2.* from contract t2 ,t1 where t2.staffid=t1.staffid) select t1.staffid,t3.refnofrom t1,t3where t1.staffid=t3.staffid