My problem is I have a table where I want to return a column from an SQL database as two different columns based on different JOIN conditions.
My two select statements:
My first statement returns the check numbers and amounts for all of our checks that have gone through the process of being deposited -> and then ipaced (just a term).
SELECT COURTESY_CHECK.CHECK_NUMBER,
COURTESY_CHECK.CHECK_AMOUNT,
CHECK_DEPOSIT.ID AS DEPOSIT_ID
FROM COURTESY_CHECK
INNER JOIN CHECK_DEPOSIT ON CHECK_DEPOSIT.COURTESY_CHECK_ID = COURTESY_CHECK.ID
INNER JOIN DEPOSIT ON CHECK_DEPOSIT_ID = DEPOSIT.ID
INNER JOIN IPAC ON DEPOSIT.ID = IPAC.DEPOSIT_ID
My second statement returns the check numbers and amounts of the checks that have just been deposited.
SELECT COURTESY_CHECK.CHECK_NUMBER,
COURTESY_CHECK.CHECK_AMOUNT,
CHECK_DEPOSIT.ID AS DEPOSIT_ID
FROM COURTESY_CHECK
INNER JOIN CHECK_DEPOSIT ON CHECK_DEPOSIT.COURTESY_CHECK_ID = COURTESY_CHECK.ID
I would like to have a table like
IPAC/DEPOSITED AMOUNT DEPOSITED AMOUNT CHECK_NUMBER
--------------------- ---------------- ------------
$4.00 123456
$5.00 654321
I'm using BIRT to compile reports and it really only allows you to chart data based on single data sets (which is a single query) AFAIK. I'd like to chart the total "IPAC/Deposited" amount versus the "Deposited" amount.
INNER JOIN IPAC ON DEPOSIT.ID = IPAC.DEPOSIT_IDshould've beenINNER JOIN IPAC ON CHECK_DEPOSIT.IPAC_ID = IPAC.ID