Subject | Re: [firebird-support] Case When Then |
---|---|
Author | André Knappstein, Controlling |
Post date | 2010-02-16T14:13:27Z |
Spasiva!
It results in the same exception, though.
The example I gave is of course a simplified draft... would it matter
that the original statement is joining 2 tables?
Select
T.ID,
CASE
WHEN (T.Units > 0) THEN sum(X.Diff/T.Units)
ELSE sum(X.Diff)
END
from
AggOrdersUnits T
join
AggOrders X
on T.ID = X.ID
where
X.Diff > 0.05
group by
T.ID,
T.Units
I found another way of exposing and eliminating these records so I am
not in a hurry with this, but just curious...
--
~~~Ihre Nachricht~~~
DS> 16.02.2010 14:45, André Knappstein, Controlling wrote:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
beta Eigenheim- und Grundstücksverwertungsgesellschaft mbH
Hafenweg 4
59192 Bergkamen-Rünthe
Telefon: +49 2389 9240 0
Telefax: +49 2389 9240 150
e-mail: info@...
Amtsgericht Hamm Nr. B 420 || USt-IDNr.: DE 125215402
Geschäftsführer: Achim Krähling, Dirk Salewski, Matthias Steinhaus
It results in the same exception, though.
The example I gave is of course a simplified draft... would it matter
that the original statement is joining 2 tables?
Select
T.ID,
CASE
WHEN (T.Units > 0) THEN sum(X.Diff/T.Units)
ELSE sum(X.Diff)
END
from
AggOrdersUnits T
join
AggOrders X
on T.ID = X.ID
where
X.Diff > 0.05
group by
T.ID,
T.Units
I found another way of exposing and eliminating these records so I am
not in a hurry with this, but just curious...
--
~~~Ihre Nachricht~~~
DS> 16.02.2010 14:45, André Knappstein, Controlling wrote:
>> But the following does throw a server exception "Invalid expression inDS> Group by T.Units in addition.
>> the select list (not contained in either an aggregate function or the
>> GROUP BY clause). How would I put that syntax right?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
beta Eigenheim- und Grundstücksverwertungsgesellschaft mbH
Hafenweg 4
59192 Bergkamen-Rünthe
Telefon: +49 2389 9240 0
Telefax: +49 2389 9240 150
e-mail: info@...
Amtsgericht Hamm Nr. B 420 || USt-IDNr.: DE 125215402
Geschäftsführer: Achim Krähling, Dirk Salewski, Matthias Steinhaus