如何从VB,NET代码执行以下注意事项CTE?

时间:2016-03-17 04:34:10

标签: sql vb.net datetime command common-table-expression

WITH cte AS 
( 
       SELECT [Status] , 
              [Date] , 
              [Time] , 
              Cast([Date] AS DATETIME) + Cast([Time] AS DATETIME) AS [datetime] 
       FROM   @MyTable ) 
SELECT   [Status] , 
         [Date] , 
         [Time] , 
         Cast(Dateadd(minute, Datediff(minute, Lag([datetime]) OVER ( ORDER BY [datetime] ), [datetime]), '00:00:00') AS TIME) AS timedifference
WHERE    date BETWEEN '"& DATETIMEPICKER1.VALUE.DATE &"' AND      '"& DATETIMEPICKER2.VALUE.DATE &"'
from     cte

0 个答案:

没有答案