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