2024-10-22 11:43:54 +00:00
|
|
|
WITH RECURSIVE numbers AS (
|
|
|
|
SELECT 1 n
|
|
|
|
UNION ALL
|
|
|
|
SELECT n + 1
|
|
|
|
FROM numbers
|
|
|
|
WHERE n < ?
|
|
|
|
)
|
|
|
|
SELECT ROW_NUMBER() OVER() labelNum,
|
2024-10-24 05:31:26 +00:00
|
|
|
b.itemFk,
|
|
|
|
i.name item,
|
|
|
|
b.id buyFk,
|
|
|
|
b.quantity,
|
|
|
|
b.packing,
|
|
|
|
b.entryFk,
|
|
|
|
o.code origin,
|
|
|
|
p.`name` producerName,
|
|
|
|
p.id producerFk,
|
|
|
|
i.`size`,
|
|
|
|
i.category,
|
|
|
|
i.stems,
|
|
|
|
i.inkFk,
|
|
|
|
ig.longName,
|
|
|
|
ig.subName,
|
|
|
|
i.comment,
|
2024-10-28 10:29:15 +00:00
|
|
|
w.code buyerName,
|
|
|
|
i.isLaid
|
2024-10-24 05:31:26 +00:00
|
|
|
FROM vn.buy b
|
|
|
|
JOIN vn.item i ON i.id = b.itemFk
|
|
|
|
LEFT JOIN vn.item ig ON ig.id = b.itemOriginalFk
|
|
|
|
JOIN vn.origin o ON o.id = i.originFk
|
|
|
|
LEFT JOIN vn.producer p ON p.id = i.producerFk
|
|
|
|
JOIN vn.itemType it ON it.id = i.typeFk
|
|
|
|
JOIN vn.worker w ON w.id = it.workerFk
|
|
|
|
JOIN numbers num
|
|
|
|
WHERE b.id = ?
|