Subject | Re: [firebird-support] Is it possible calculate result of aggregates? |
---|---|
Author | setysvar |
Post date | 2016-01-22T22:05:41Z |
Den 22.01.2016 11:51, skrev Luigi Siciliano luigisic@...
[firebird-support]:
(SELECT A, B, SUM(A+B)
FROM TABLE
GROUP BY A, B)
SELECT A, B, C, C*A as D
FROM TMP
Note that with two identical rows
A B
2 2
2 2
The result will be
A B C D
2 2 8 16
HTH,
Set
[firebird-support]:
> How can I do this query:WITH TMP(A, B, C) AS
>
> Select
> A,
> B,
> SUM(A + B) as C,
> C * A as D ----->>>>> FB result on "C not Exists" error!
> from
> table
> group by
> A,
> B
>
> Of course, I can do this: "SUM(A + B) * A as D" to perform my query but,
> I wish to learn if is possible the other one (C * A as D)
>
> Thanks.
(SELECT A, B, SUM(A+B)
FROM TABLE
GROUP BY A, B)
SELECT A, B, C, C*A as D
FROM TMP
Note that with two identical rows
A B
2 2
2 2
The result will be
A B C D
2 2 8 16
HTH,
Set