This is my current SQL query:
SELECT
SUM(CASE WHEN (DATEDIFF(day, tbl_debit.purchasedate, GETDATE()) >= 45)
THEN tbl_invoices.pendingamount ELSE 0 END) AS morethan45,
SUM(CASE WHEN (DATEDIFF(day, tbl_debit.purchasedate, GETDATE()) < 45)
THEN tbl_invoices.pendingamount ELSE 0 END) AS lessthan45
FROM
tbl_debit
INNER JOIN
tbl_invoices ON tbl_debit.invoice = tbl_invoices.invoice
WHERE
(tbl_invoices.state = - 1)
Output of above query is shown here:
morethan45 | lessthan45
750 | 710
And I want to create a new table like below. Is it possible to create something new like below
Column 1 | Column 2
morethan45 | 750
lessthan45 | 710