Using SQL Server 2016, I have a table that contains a column DateTime
of type INT
which contains a UNIX timestamp. So if I want to get all the rows where the timestamp is yesterday, I know I need to check if the timestamp is >= the timestamp for 'yesterday at 00:00' and <= 'yesterday at 23:59'.
How can I do this with SQL Server 2016?
Found a few examples but they where for MySQL. I did find this example below. But it throws an error, so I'm probably not using it correctly. Or actually, this might be MySQL as well...
WHERE [DateTime] <= DATEADD(day, -1, convert(day, GETDATE()))
Any help would be greatly appreciated!