update view pos master
This commit is contained in:
parent
f80e53804a
commit
a55fd3d6d0
2 changed files with 22 additions and 4 deletions
|
|
@ -97,8 +97,17 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
) pl2 ON pl1.profileId = pl2.profileId
|
||||
AND pl1.createdAt = pl2.maxDate
|
||||
) AS profileLeave ON profileLeave.profileId = employeePosMaster.current_holderId
|
||||
LEFT JOIN
|
||||
profileAssessment ON profileAssessment.profileId = profileEmployee.id
|
||||
LEFT JOIN (
|
||||
SELECT pa1.*
|
||||
FROM profileAssessment pa1
|
||||
INNER JOIN (
|
||||
SELECT profileId, MAX(createdAt) AS maxDate
|
||||
FROM profileAssessment
|
||||
GROUP BY profileId
|
||||
) pa2 ON pa1.profileId = pa2.profileId
|
||||
AND pa1.createdAt = pa2.maxDate
|
||||
) AS profileAssessment
|
||||
ON profileAssessment.profileId = profileEmployee.id
|
||||
LEFT JOIN
|
||||
employeePosLevel ON profileEmployee.posLevelId = employeePosLevel.id
|
||||
LEFT JOIN
|
||||
|
|
|
|||
|
|
@ -97,8 +97,17 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
|||
AND pl1.createdAt = pl2.maxDate
|
||||
) AS profileLeave
|
||||
ON profileLeave.profileId = posMaster.current_holderId
|
||||
LEFT JOIN
|
||||
profileAssessment ON profileAssessment.profileId = profile.id
|
||||
LEFT JOIN (
|
||||
SELECT pa1.*
|
||||
FROM profileAssessment pa1
|
||||
INNER JOIN (
|
||||
SELECT profileId, MAX(createdAt) AS maxDate
|
||||
FROM profileAssessment
|
||||
GROUP BY profileId
|
||||
) pa2 ON pa1.profileId = pa2.profileId
|
||||
AND pa1.createdAt = pa2.maxDate
|
||||
) AS profileAssessment
|
||||
ON profileAssessment.profileId = profile.id
|
||||
LEFT JOIN
|
||||
posLevel ON profile.posLevelId = posLevel.id
|
||||
LEFT JOIN
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue