w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to verify whether records exist for the last x days (calendar days) in SQL not using the between key word

Is this what you want?

SELECT
      * 
FROM 
      Table1
WHERE
      FLIGHT_DATE  > dateadd(day,-6,datediff(day,0,getdate())) 
AND 
      FLIGHT_DATE < GETDATE();

SQL FIDDLE





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.