salix/print/templates/reports/claim-pickup-order/sql/client.sql

19 lines
436 B
SQL

SELECT
c.id,
c.socialName,
c.name,
c.fi,
a.city,
a.postalCode,
a.street,
a.nickname,
p.name AS province,
ct.country
FROM claim cl
JOIN client c ON c.id = cl.clientFk
JOIN account.user u ON u.id = c.id
JOIN country ct ON ct.id = c.countryFk
JOIN ticket t ON t.id = cl.ticketFk
JOIN address a ON a.id = t.addressFk
LEFT JOIN province p ON p.id = c.provinceFk
WHERE cl.id = ?