fayevalentine
Programmer
Hi
I have a little problem with this query, I want to know if it is the first time something happen, so I use OVER instruction, but inside my application I could insert a date range and my query just count the data selected and I have to count all table:
example
date event result (what I need)
01-09-2015 something 1
02-09-2015 other 1
10-09-2015 something 2
11-09-2015 something 3
so if I select range date 10-09-2015 to 11-09-2015 i need to return
date event result
10-09-2015 something 2
11-09-2015 something 3
but my query gets:
date event result
10-09-2015 something 1
11-09-2015 something 2
which is incorrect.
Here my query very simplified because I make several joins:
select something, sum(count(something)) over (order by trunc(date)) as running_total
from my_table
where date > selected_date
and date < selected_date_2
So Im still unable to make my query count all registers because of where condition, could anyone give me a hint?
Thanks in advance.
I have a little problem with this query, I want to know if it is the first time something happen, so I use OVER instruction, but inside my application I could insert a date range and my query just count the data selected and I have to count all table:
example
date event result (what I need)
01-09-2015 something 1
02-09-2015 other 1
10-09-2015 something 2
11-09-2015 something 3
so if I select range date 10-09-2015 to 11-09-2015 i need to return
date event result
10-09-2015 something 2
11-09-2015 something 3
but my query gets:
date event result
10-09-2015 something 1
11-09-2015 something 2
which is incorrect.
Here my query very simplified because I make several joins:
select something, sum(count(something)) over (order by trunc(date)) as running_total
from my_table
where date > selected_date
and date < selected_date_2
So Im still unable to make my query count all registers because of where condition, could anyone give me a hint?
Thanks in advance.