SELECT io.id, io.ref, io.issued, io.companyFk FROM invoiceOut io LEFT JOIN ticket t ON t.refFk = io.ref WHERE t.refFk = ?