I am trying to use this query to add records with a 'dateofApplication' date of 15 days ago:
SELECT *
FROM [UG Journey Master]
WHERE [dateofApplication] = DateAdd(day,-15,GetDate())
Unfortunately, it adds 0 records to my data extension.
The first part is correct, as when I use a different WHERE clause (such as Email_Address Like 'Z%') works fine. So there is something wrong with my DateAdd clause.
Can anyone help?
Best Answer
You'll need to consider the time portion of the dates. Here's a sargable way to do it:
Casting
getDate()
as adate
, will reset the time part of the date to zero (midnight).Update (20170804)
Here's a more efficient way to do it: