We are using the below code in the WHERE clause of an sql query to return a date of 7 days ago. However, I don't actually understand how it is working.
I've read about the DATEDIFF() and DATEADD() functions but they don't match the above.
DATEDIFF() should be (interval, date, date), but above it is (interval, number, date).
DATEADD() should be (interval, number, date), but above it just has a 0 for the date.
The thing is, it works. It gives the expected output of 7 days ago.
Can anyone help me understand why and how this is working?