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