Skip to content
Advertisement

ORACLE SQL: Group the data by the last 4 weeks

i have a trouble with dates, i need to do a query that count the ids from the last four weeks.

I tried this, but it doesn’t works.

I need a output like this

So, the ” count(a.id) ” values are the count of the ID’s in one of the past 4 weeks.

Advertisement

Answer

Here’s a MS SQL Server solution. You should be able to convert it to Oracle if needed.

And here’s my attempt at doing this in Oracle.

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