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

20 lines
327 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,
i.tag8,
i.value8
FROM buy b
JOIN item i ON i.id = b.itemFk
LEFT JOIN item i2 ON i2.id = b.itemOriginalFk
WHERE b.entryFk = ?