sql - TSQL WHERE LocalDateTime >= DATEADD returns an extra hour of data with NULL values -


when query db with

select * dvalues positionid = 1 

i receive 2013-04-05 07:00:00 recent time stamp in localdatetime column present in db data exists.

however, when run following query retrieves last 10 days of data

select * (     select cast(localdatetime smalldatetime) [datetime],         datavalue, variableid     dvalues     siteid = 1 , positionid between 1 , 37 ,         localdatetime >= dateadd (day, -10, getdate())     ) tabledate pivot (sum(datavalue) variableid     in ([3],[30],[10],[25],[26],[37])) pivottable order [datetime] 

the recent time stamp has value of 2013-04-05 08:00:00 , returns null data because there no data time.

i don't understand how localdatetime >= dateadd (day, -10, getdate()) can result in returning record time stamp no data exists in db.

maybe somehow associated standard time vs daylight savings time? data stored in standard time, system time running on daylight savings time. 1 hour offset in results caused that?

edit: turned out null values returned had nothing time @ all. in above query values positionids between 1 , 37 returned selected positionids included pivot table.

of positionid values included none available latest time stamp, in result set of positionid between 1 , 37 there positionids values present 2013-04-05 07:00:00 time stamp, created such record in db , filled in null positionids didn't have values @ time stamp.


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -