Headder AdSence

Finding Last Seven Days Data

How to find last seven days data and if any of days data is null then gives null.

This explanation about Oracle SQL Query:

Generally most of the people confuse here is how to handle NULL values.

so, here I am going to show you how we can do this.

I am taking Sales Date  and replacing NVL with SYSDATE means it treats like this is the Max or today date greater than or equal to SYSDATE-7 means seven days back date (ex 2017-11-4 - 7 days: 2017-10-29)

Query:

SELECT * FROM Tbl_Daily_Sales WHERE NVL(Sale_Date,SYSDATE) >= (SYSDATE-7);

Please find below Output:



Please give your valuable  comments & questions

No comments:

Post a Comment