I'm trying to write a SQL statement where I pull all records for the previous day. My initial attempt looks like:select dateadd(day, -1, CONVERT(DATETIME, GETDATE(), 102))
which returns:2012-04-03 14:51:14.317
So I can tell the code is actually returning yesterday's date at the exact time I test run the query.But when I insert the code into my larger SQL statement to pull actual data, nothing is returned. I believe because it might be that it is not only looking for records for that previous day, but for records that match that hour/minute as well.Would this be in the case? And if so, how could I strip the date down into the yy/mm/dd only?Thanks,