salix/print/templates/reports/invoice/sql/tickets.sql

13 lines
322 B
SQL

SELECT
t.id,
t.shipped,
t.nickname,
tto.description
FROM invoiceOut io
JOIN ticket t ON t.refFk = io.REF
LEFT JOIN observationType ot ON ot.code = 'invoiceOut'
LEFT JOIN ticketObservation tto ON tto.ticketFk = t.id
AND tto.observationTypeFk = ot.id
WHERE t.refFk = ?
ORDER BY t.shipped