Skip to content
Advertisement

weekly max count record in oracle

table test has column id,created_date,sal and data like below:

ID create_date sal
1 20-JAN-2021 5000
2 20-JAN-2021 6000
3 19 -JAN- 2021 4000

we have data like this for each date.

I pick the each day record count using below query:

I want output for max record count for a weekly basis:

count(*) create_date
500 20 – JAN-2021
600 10 – JAN – 2021
300 1 – JAN – 2021

Please suggest.

like this.

Please

Advertisement

Answer

You can use trunc date to iso week and use two level grouping as follows:

If you want the date also then you need to use analytical function as dollows:

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