best way to “glue” columns together

前端 未结 2 1820
Happy的楠姐
Happy的楠姐 2020-12-12 05:09

I need to combine columns from about 15 tables in one large table. Something the following works. But it takes very long to run while the CPU usage spikes to 100%, which cau

2条回答
  •  一向
    一向 (楼主)
    2020-12-12 05:32

    Is there a reason you're using row_number() over

    It looks like you want something like this...

    SELECT t1.empid, t2.phone, t3.license, t4.email
    FROM @t1 t1
    LEFT JOIN @t2 t2 ON t1.EmpId = t2.EmpId
    LEFT JOIN @t3 t3 ON t1.EmpId = t3.EmpId
    LEFT JOIN @t4 t4 ON t1.EmpId = t4.EmpId
    

提交回复
热议问题