Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
SQLScript
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TongZuu
SQLScript
Commits
c947b9f0
Commit
c947b9f0
authored
Apr 03, 2015
by
TongZuu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add column companyid
parent
30be80d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
VW_CHEMICAL.sql
SQL Server/VIEW/VW_CHEMICAL.sql
+3
-2
No files found.
SQL Server/VIEW/VW_CHEMICAL.sql
View file @
c947b9f0
...
...
@@ -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
.
C
OMPANYID
,
C0
.
C
HEMIID
,
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
.
C
OMPANYID
,
B1
.
C
HEMIID
,
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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment