salix/print/methods/csv/delivery-note/sql/ticket.sql

9 lines
219 B
SQL

SELECT
t.id,
t.clientFk,
c.email recipient,
eu.email salesPersonEmail
FROM ticket t
JOIN client c ON c.id = t.clientFk
LEFT JOIN account.emailUser eu ON eu.userFk = c.salesPersonFk
WHERE t.id = ?