Original query:

      LEFT JOIN (
                  SELECT invoices.id AS invoice_id,
                         string_agg(invoice_items.description, E'\n') description,
                         string_agg(invoice_items.details, E'\n') details
                  FROM billing_abstract_invoices invoices,
                       (SELECT ii.invoice_id, ii.description, ii.details, ii.created_at FROM billing_invoice_items ii ORDER BY ii.created_at ASC) invoice_items
                  WHERE (invoice_items.invoice_id = invoices.id)
                  GROUP BY invoices.id
                ) AS invoice_details ON invoices.id=invoice_details.invoice_id