sql server 2008 r2 - Get yesterday's rows startign from 10AM -


for previous day used use below expression .

     date_inserted >=dateadd(day, datediff(day,0,getdate())-1,0)       ,  date_inserted < dateadd(day, datediff(day,0,getdate()),0) 

how rows yesterday 10am today 10am

-- yesterday @ midnight: declare @yesterday datetime = dateadd(day,datediff(day,1,getdate()),0);  select ... date_inserted >= dateadd(hour, 10, @yesterday)  -- 10 yesterday   , date_inserted <  dateadd(hour, 34, @yesterday); -- 10 today 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -