Subject | Re: [firebird-support] Re: (Repost) Problem with SUM() on a computed column |
---|---|
Author | Helen Borrie |
Post date | 2003-07-21T03:52:29Z |
At 02:55 AM 21/07/2003 +0000, you wrote:
keys. The above ought to be:
SELECT
X.*,
(SELECT SUM(Y.AMOUNT)
FROM Y
WHERE Y.CODE = X.CODE) AS TOTALAMOUNT
FROM X
InterBase will let you do ambiguous correlations like your
example; Firebird will let you do it dialect 1 (it should give you a
warning) but won't allow it in dialect 3. Just because you don't get a
warning in IB doesn't mean that the ambiguity is OK.
heLen
>By the way, in relation to this, is it safe to do queries like:It is - provided you get the syntax right for correlating the two
>
>SELECT
> X.*,
> (SELECT SUM(AMOUNT)
> FROM Y
> WHERE CODE = X.CODE) AS TOTALAMOUNT
>FROM
> X
keys. The above ought to be:
SELECT
X.*,
(SELECT SUM(Y.AMOUNT)
FROM Y
WHERE Y.CODE = X.CODE) AS TOTALAMOUNT
FROM X
InterBase will let you do ambiguous correlations like your
example; Firebird will let you do it dialect 1 (it should give you a
warning) but won't allow it in dialect 3. Just because you don't get a
warning in IB doesn't mean that the ambiguity is OK.
heLen
>Thanks Helen:)
>
>Joeny
>
>
>
>
>To unsubscribe from this group, send an email to:
>firebird-support-unsubscribe@yahoogroups.com
>
>
>
>Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/