SELECT io.amount, io.ref, io.issued, ict.description FROM invoiceOut io JOIN invoiceCorrection ic ON ic.correctingFk = io.id JOIN invoiceCorrectionType ict ON ict.id = ic.invoiceCorrectionTypeFk LEFT JOIN ticket t ON t.refFk = io.ref WHERE io.ref = ?