Skip to content
Advertisement

SQL Count In Range

How could I count data in range which could be configured
Something like this,

Table ZONE_CFG is configurable, so I could not use static value for this
The DATE column mean maximum date for each ZONE

And the result what I expected :

Please could someone help me with this

Advertisement

Answer

You can use LAG and group by as following:

Note: Don’t use oracle preserved keywords (DATE, in your case) as the name of the columns. Try to change it to something like DATE_ or DATE_START or etc..

Cheers!!

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement