salix/print/templates/reports/invoiceIn/sql/buy.sql

19 lines
350 B
SQL

SELECT
b.id,
e.id entryFk,
it.name,
b.quantity,
b.buyingValue,
(b.quantity * b.buyingValue) total,
it.tag5,
it.value5,
it.tag6,
it.value6,
it.tag7,
it.value7
FROM entry e
JOIN invoiceIn i ON i.id = e.invoiceInFk
JOIN buy b ON b.entryFk = e.id
JOIN item it ON it.id = b.itemFk
WHERE i.id = ?