partition by - where clause
763735Apr 7 2010 — edited Mar 21 2012Hi,
I have to use a where clause within the partition by clause in my sql. Is it possible to use so?
The reason is - I am doing 3 partition by s in my select statement each having a different selection condition.
For eg.
It is something like this:
select a, b,
sum(sales) over (partition by area ) where area = 'North' ,
sum(sales) over (partition by zone ) where zone = 'XYZ',
sum(sales) over (partition by state) where state = 'MP'
from table
any shortcuts to do that?
I tried using having clause within the partition by clause but i guess it is not allowed.
Any suggestions, please help. Thanks.