salix/print/templates/reports/entry-order/sql/buys.sql

18 lines
305 B
SQL

SELECT b.itemFk,
b.quantity,
b.buyingValue,
b.stickers,
b.packing,
i.name,
IFNULL(i2.comment, i.comment) comment,
i.tag5,
i.value5,
i.tag6,
i.value6,
i.tag7,
i.value7
FROM buy b
JOIN item i ON i.id = b.itemFk
LEFT JOIN item i2 ON i2.id = b.itemOriginalFk
WHERE b.entryFk = ?