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