|
SELECT IF(incotermsFk IS NULL, FALSE, TRUE) AS hasIncoterms
|
|
FROM ticket t
|
|
JOIN invoiceOut io ON io.ref = t.refFk
|
|
JOIN client c ON c.id = t.clientFk
|
|
JOIN address a ON a.id = t.addressFk
|
|
WHERE t.refFk = ?
|
|
AND IF(c.hasToinvoiceByAddress = FALSE, c.defaultAddressFk, TRUE)
|
|
LIMIT 1 |