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,
|
2024-10-28 13:51:19 +00:00
|
|
|
i.isLaid,
|
|
|
|
c.code company
|
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
|
2024-10-28 13:51:19 +00:00
|
|
|
JOIN vn.entry e ON e.id = b.entryFk
|
|
|
|
JOIN vn.company c ON c.id = e.companyFk
|
2024-10-24 05:31:26 +00:00
|
|
|
JOIN numbers num
|
|
|
|
WHERE b.id = ?
|