[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
- Subject: Re: Problem with Union & Union Vs Array
- From: "C. Willis III" <ceprn@HOTMAIL.COM>
- Date: Wed, 7 Oct 1998 07:31:13 CDT
Adrian,
The first thing I see you are doing incorrectly is declaring a column
variable as a string in this piece of code :
begin-SELECT DISTINCT ON-ERROR=3DSQL-Error
A.PROJECT_ID $P1
SUM(A.POSTED_TOTAL_AMT) &A.POSTED_TOTAL_AMT
SUM(A.ENCUMBERED_AMOUNT) &A.ENCUMBERED_AMOUNT
begin-SELECT DISTINCT ON-ERROR=3DSQL-Error
It should read :
A.PROJECT_ID &P1
SUM(A.POSTED_TOTAL_AMT) &A.POSTED_TOTAL_AMT
SUM(A.ENCUMBERED_AMOUNT) &A.ENCUMBERED_AMOUNT
let $P1 = &P1
The rest of your union looks fine to me... same number of objects
selected, order by.... Maybe there is some inherent maximum number of
Unions you can perform with Sybase????
***BUT***, why are you using a union? The code you have provided comes
from the same table (do the others?) and is different only in the
account range. Why not use a single select with OR logic such as
AND ((A.ACCOUNT BETWEEN '1800' AND '1899')
OR (A.ACCOUNT BETWEEN '2000' AND '2199')
OR (A.ACCOUNT BETWEEN 'xx00' AND 'xx99')
OR (A.ACCOUNT BETWEEN 'yy00' AND 'yy99'))
?????
As to your arrays question, I have had varying results with using them
in regards to them actually saving overhead since you still have the
overhead of building them in the first place, then massaging the data
until you get what you want, and it always seems harder to me to debug
array logic than straight forward code.
You should be able to do all your grouping with order by and on-break
logic.
hope this helps
clark
----Original Message Follows----
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com