feat: #6782 sin as
gitea/salix/pipeline/pr-dev This commit looks good Details

This commit is contained in:
Javi Gallego 2024-03-26 14:02:47 +01:00
parent b978833a64
commit 1472fc6fc2
1 changed files with 2 additions and 2 deletions

View File

@ -37,7 +37,7 @@ BEGIN
WITH rankedWorkers AS (
SELECT sm.id,
st.workerFk,
ROW_NUMBER() OVER(PARTITION BY sm.id ORDER BY s2.`order`) AS rnk
ROW_NUMBER() OVER(PARTITION BY sm.id ORDER BY s2.`order`) rnk
FROM vn.saleMistake sm
JOIN vn.saleTracking st ON sm.saleFk = st.saleFk
JOIN vn.`state` s2 ON s2.id = st.stateFk
@ -46,7 +46,7 @@ BEGIN
WHERE t.shipped BETWEEN vDatedFrom AND vDatedTo
AND s2.code IN ('OK', 'PREVIOUS_PREPARATION', 'PREPARED', 'CHECKED')
)
SELECT workerFk, COUNT(*) AS errors
SELECT workerFk, COUNT(*) errors
FROM rankedWorkers
WHERE rnk = 1
GROUP BY workerFk;