Commit c947b9f0 by TongZuu

add column companyid

parent 30be80d5
......@@ -4,11 +4,11 @@ go
CREATE VIEW [dbo].[VW_CHEMICAL]
AS
WITH TMP AS(
SELECT C0.CHEMIID,C0.EMPLOYEEID,C1.DATEID,C1.TIME0ID,C1.START_DATE,C1.START_TIME,C1.END_DATE,C1.END_TIME,SOURCE,'SELF' AS DT_SOURCE
SELECT C0.COMPANYID,C0.CHEMIID,C0.EMPLOYEEID,C1.DATEID,C1.TIME0ID,C1.START_DATE,C1.START_TIME,C1.END_DATE,C1.END_TIME,SOURCE,'SELF' AS DT_SOURCE
FROM CHEMICALROOM0 C0
LEFT OUTER JOIN CHEMICALROOM1 C1 ON C0.CHEMIID = C1.CHEMIID
UNION ALL
SELECT B1.CHEMIID,B1.EMPLOYEEID,B1.DATEID,B1.TIME0ID,B1.START_DATE,B1.START_TIME,B1.END_DATE,B1.END_TIME,SOURCE,'BOSS' AS DT_SOURCE
SELECT B1.COMPANYID,B1.CHEMIID,B1.EMPLOYEEID,B1.DATEID,B1.TIME0ID,B1.START_DATE,B1.START_TIME,B1.END_DATE,B1.END_TIME,SOURCE,'BOSS' AS DT_SOURCE
FROM CHEMICALROOM1_BOSS B1
)
SELECT ROW_NUMBER() OVER(PARTITION BY EMPLOYEEID,DATEID ORDER BY EMPLOYEEID,DATEID) AS IDX,* FROM TMP
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment