I have a query with the following structure -
select a.a1,b.b1,c.c1,d.d1,
count(e.e1) over (partition by e.e2)
from a join b
on a.aid = b.bid
join c
on b.bid = c.cid
join e
......many other joins;
The problem is that I want to do something like count(e.e1) over (partition by e.e2 where e.e2 = 'mouse')
I mean I want to partition by the e2 column but consider one of the partitions.
For example, if e2 columns had the following values - "mouse", "cat" and "dog". Then the above query would give an output resembling the following -
a11 b11 c11 d11 4 -> record for "mouse"
a11 b11 c11 d11 5 -> record for "cat"
a11 b11 c11 d11 7 -> record for "dog"
Now, I don't want the records for "cat" and "dog". I only want for "mouse". Any suggestions?