diff --git a/db/routines/vn/procedures/collectionPlacement_get.sql b/db/routines/vn/procedures/collectionPlacement_get.sql index 7f7e23178..e302f8d3c 100644 --- a/db/routines/vn/procedures/collectionPlacement_get.sql +++ b/db/routines/vn/procedures/collectionPlacement_get.sql @@ -96,7 +96,8 @@ BEGIN LEFT JOIN parking p2 ON p2.id = sg.parkingFk WHERE w.id = vWarehouseFk AND NOT sc.isHideForPickers - AND ((iss.id IS NOT NULL AND st.saleFk IS NOT NULL) OR st.saleFk IS NULL); + AND ((iss.id AND st.saleFk) OR st.saleFk IS NULL) + GROUP BY st.saleFk, created; CREATE OR REPLACE TEMPORARY TABLE tSalePlacementList2 (INDEX(saleFk), INDEX(olderPriority))