Skip to content
Advertisement

Query SQL Server From Specific Time On Previous Date To Specific Time On Current Date

Sorry for the noob SQL question. I have a table in SQL with a DateTime column. I need to run a script daily to show any lines from 8am yesterday until 8am today. So for example, today I would run:

I also know that I could run this, but this will only give me the previous day through the current time:

But is there a trick to creating the script so I can get 8am yesterday through 8am today without manually editing the script every day?

Advertisement

Answer

I would recommend:

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement