Hello,
I am using two derived tables in one Query. In that query, only difference is date field. First query, I am using today's date and second query, I am using previous date.
I want to use in single query(one derived table) with two above mentioned dates.
Can I use both dates in single derived table.
This is the query.
1.
SELECT
COALESCE(SUM(ENDING_LEDGER_BALANCE_AMT),0)
FROM
DD_TEDW.T0305_ACCOUNT_SUMMARY_DERIVE A
INNER JOIN
DD_TEDW.T0303_ACCOUNT_STATUS_HISTORY B
ON A.ACCOUNT_NBR = B.ACCOUNT_NBR
WHERE A.ACCOUNT_NBR = 960294
AND B.ACCT_STATUS_TYPE_CODE = 1
AND A.ACCOUNT_SUMMARY_DATE IN ('2002-10-31')
2.
SELECT
COALESCE(SUM(ENDING_LEDGER_BALANCE_AMT),0)
FROM
DD_TEDW.T0305_ACCOUNT_SUMMARY_DERIVE A
INNER JOIN
DD_TEDW.T0303_ACCOUNT_STATUS_HISTORY B
ON A.ACCOUNT_NBR = B.ACCOUNT_NBR
WHERE A.ACCOUNT_NBR = 960294
AND B.ACCT_STATUS_TYPE_CODE = 1
AND A.ACCOUNT_SUMMARY_DATE = ( Select calendar_date - 1 From sys_calendar.calendar t2 Where t2.calendar_date = '2002-10-31' ) .
I want to use both where condition in one query. is it possible.because, I am using same concept for 118 derived tables.So, it's exceeds the parser limit. Please help me
for this.
Regards
I am using two derived tables in one Query. In that query, only difference is date field. First query, I am using today's date and second query, I am using previous date.
I want to use in single query(one derived table) with two above mentioned dates.
Can I use both dates in single derived table.
This is the query.
1.
SELECT
COALESCE(SUM(ENDING_LEDGER_BALANCE_AMT),0)
FROM
DD_TEDW.T0305_ACCOUNT_SUMMARY_DERIVE A
INNER JOIN
DD_TEDW.T0303_ACCOUNT_STATUS_HISTORY B
ON A.ACCOUNT_NBR = B.ACCOUNT_NBR
WHERE A.ACCOUNT_NBR = 960294
AND B.ACCT_STATUS_TYPE_CODE = 1
AND A.ACCOUNT_SUMMARY_DATE IN ('2002-10-31')
2.
SELECT
COALESCE(SUM(ENDING_LEDGER_BALANCE_AMT),0)
FROM
DD_TEDW.T0305_ACCOUNT_SUMMARY_DERIVE A
INNER JOIN
DD_TEDW.T0303_ACCOUNT_STATUS_HISTORY B
ON A.ACCOUNT_NBR = B.ACCOUNT_NBR
WHERE A.ACCOUNT_NBR = 960294
AND B.ACCT_STATUS_TYPE_CODE = 1
AND A.ACCOUNT_SUMMARY_DATE = ( Select calendar_date - 1 From sys_calendar.calendar t2 Where t2.calendar_date = '2002-10-31' ) .
I want to use both where condition in one query. is it possible.because, I am using same concept for 118 derived tables.So, it's exceeds the parser limit. Please help me
for this.
Regards