CASE and Group by [message #19455] |
Tue, 19 March 2002 10:32 |
uma
Messages: 67 Registered: May 2001
|
Member |
|
|
I have a condition to verify and I want to group by for some fields. My query is like this
Select
product_id,
type_id,
case(when product_type!=2 then
sum(amount * quantity* rate)
else 0) amount
from Product
group by
product_id,
type_id,
case(when product_type!=2 then
sum(amount * quantity* rate)
else 0)
Can I use CASE in the group by ? I don't think so, in that case what I need to use in the group by clause. Is that product_type should be in the group by? I am puzzled, please help me.
Thanks,
Uma
|
|
|
Re: CASE and Group by [message #19456 is a reply to message #19455] |
Tue, 19 March 2002 10:55 |
uma
Messages: 67 Registered: May 2001
|
Member |
|
|
I think if I add product_type in my group by clause in stead of the whole case statment , it is woking. I hop e that is right.
Thanks,
Uma
|
|
|