SELECT c.id,
        c.socialName,
        c.street postalAddress,
        IF (ios.taxAreaFk IS NOT NULL, CONCAT(cty.code, c.fi), c.fi) fi,
        CONCAT(c.postcode, ' - ', c.city) postcodeCity
    FROM vn.invoiceOut io
        JOIN vn.client c ON c.id = io.clientFk
        JOIN vn.country cty ON cty.id = c.countryFk
        LEFT JOIN vn.invoiceOutSerial ios ON ios.code = io.serial
            AND ios.taxAreaFk = 'CEE'
        LEFT JOIN ticket t ON t.refFk = io.ref
    WHERE t.refFk = ?