Please help me understand the SQL Select statement below:
Select DATEADD(DAY, DATEDIFF(DAY, 0, GETDATE()) - 1, 0)
The 0s are throwing me off.
The date 0 is interpreted as 1/1/1900.
This statement is determining the number of days since 1/1/1900:
DATEDIFF(DAY, 0, GETDATE())
It's wrapped in another call that adds that many days, minus 1, to 1/1/1990 (0).
DATEADD(DAY, <from above> - 1, 0)
Essentially giving you yesterday's date.