I'm new to Informix and I'm unable to get a working inline view as per OracleSql. I'm executing the following statement:
SELECT A.ACCT_ID, A.BALANCE, A.SUM_AP, NEWPAY.SUMBALANCE
FROM TACCT A,
(SELECT ACCT_ID, SUM(AMOUNT) AS SUMBALANCE
FROM TJRNL
WHERE CR_DATE=CURRENT
GROUP BY ACCT_ID) AS NEWPAY
WHERE A.ACCT_ID=NEWPAY.ACCT_ID
and receive the Error: A syntax error has occurred. (State:37000, Native Code: FFFFFF37)
Problem seems to lie with the sub query -
(SELECT ACCT_ID, SUM(AMOUNT) AS SUMBALANCE
FROM TJRNL
WHERE CR_DATE=CURRENT
GROUP BY ACCT_ID) AS NEWPAY
This runs as long as I remove the table alias 'AS NEWPAY' but obviously I need the alias to be able to join.
Any ideas what's wrong - or is there not the concept of inline view in Informix.
I'm using WinSql Client with an ODBC connection to the Informix database.
Thanks
SELECT A.ACCT_ID, A.BALANCE, A.SUM_AP, NEWPAY.SUMBALANCE
FROM TACCT A,
(SELECT ACCT_ID, SUM(AMOUNT) AS SUMBALANCE
FROM TJRNL
WHERE CR_DATE=CURRENT
GROUP BY ACCT_ID) AS NEWPAY
WHERE A.ACCT_ID=NEWPAY.ACCT_ID
and receive the Error: A syntax error has occurred. (State:37000, Native Code: FFFFFF37)
Problem seems to lie with the sub query -
(SELECT ACCT_ID, SUM(AMOUNT) AS SUMBALANCE
FROM TJRNL
WHERE CR_DATE=CURRENT
GROUP BY ACCT_ID) AS NEWPAY
This runs as long as I remove the table alias 'AS NEWPAY' but obviously I need the alias to be able to join.
Any ideas what's wrong - or is there not the concept of inline view in Informix.
I'm using WinSql Client with an ODBC connection to the Informix database.
Thanks