อัพเดท view_pos_master
This commit is contained in:
parent
b26cbad5ee
commit
8f6637a656
1 changed files with 12 additions and 8 deletions
|
|
@ -78,14 +78,18 @@ import { ViewColumn, ViewEntity } from "typeorm";
|
||||||
LEFT JOIN
|
LEFT JOIN
|
||||||
posExecutive ON position.posExecutiveId = posExecutive.id
|
posExecutive ON position.posExecutiveId = posExecutive.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM profileDiscipline pd1
|
FROM (
|
||||||
WHERE pd1.date = (
|
SELECT
|
||||||
SELECT MAX(pd2.date)
|
pd.*,
|
||||||
FROM profileDiscipline pd2
|
ROW_NUMBER() OVER (
|
||||||
WHERE pd2.profileId = pd1.profileId
|
PARTITION BY profileId
|
||||||
)
|
ORDER BY date DESC, id DESC
|
||||||
) AS profileDiscipline ON profileDiscipline.profileId = profile.id
|
) AS rn
|
||||||
|
FROM profileDiscipline pd
|
||||||
|
) t
|
||||||
|
WHERE rn = 1
|
||||||
|
) AS profileDiscipline ON profileDiscipline.profileId = profile.id
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT pl1.*
|
SELECT pl1.*
|
||||||
FROM profileLeave pl1
|
FROM profileLeave pl1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue