[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: Problem with Union & Union Vs Array



Part of the code you sent was....

 begin-SELECT DISTINCT ON-ERROR=SQL-Error

 A.PROJECT_ID              $P1
 SUM(A.POSTED_TOTAL_AMT)   &A.POSTED_TOTAL_AMT
 SUM(A.ENCUMBERED_AMOUNT)  &A.ENCUMBERED_AMOUNT

   Do Print-Totals


 FROM PS_LEDGER A
 WHERE A.BUSINESS_UNIT = 'UNSYD'
   AND A.DEPTID        = 'F001'
   AND A.ACCOUNTING_PERIOD = 9
   AND (A.ACCOUNT BETWEEN '1800' AND '1899')
   AND A.FISCAL_YEAR   = 1998
   AND A.STATISTICS_CODE = ' '

I think the problem is that you need to use the & designation for all of
your column synonyms instead of a $ or # (which you used later in your
post).

So instead of this...

 begin-SELECT DISTINCT ON-ERROR=SQL-Error

 A.PROJECT_ID              $P1
 SUM(A.POSTED_TOTAL_AMT)   &A.POSTED_TOTAL_AMT
 SUM(A.ENCUMBERED_AMOUNT)  &A.ENCUMBERED_AMOUNT

Try this...

 begin-SELECT DISTINCT ON-ERROR=SQL-Error

 A.PROJECT_ID              &P1
 SUM(A.POSTED_TOTAL_AMT)   &A_POSTED_TOTAL_AMT
 SUM(A.ENCUMBERED_AMOUNT)  &A_ENCUMBERED_AMOUNT

Since you're doing your union join, you'll need to make sure your &POSTED
and &ENCUMBERED synonyms are unique, so instead of &A.field, use &A_field.

Hope this is correct.  Good Luck.