SQL 查询一天中 每隔5分钟的数据 的sql语句

 1 declare @flag1 varchar(32) set @flag1='c115:'
 2 declare @flag2 varchar(32) set @flag2='c116:'
 3 select   SampleTime ,  
 4 replace ( substring ( SampleValues , charindex ( ''+@flag1+'' , SampleValues ) , charindex ( ',', substring ( SampleValues , charindex ( ''+@flag1+'' , SampleValues ) , len ( SampleValues ) ) ) - 1 ) ,''+@flag1+'' , '')   
 5 as YcValue1  ,
 6 replace ( substring ( SampleValues , charindex ( ''+@flag2+'' , SampleValues ) , charindex ( ',', substring ( SampleValues , charindex ( ''+@flag2+'' , SampleValues ) , len ( SampleValues ) ) ) - 1 ) ,''+@flag2+'' , '')   
 7 as YcValue2
 8 from [SHDQ_MGM1000_TEST].[dbo].[TYcHistory_201707]    
 9 where 1=1 
10 and ( charindex (''+@flag1+'' , SampleValues ) > 0 or charindex (''+@flag2+'' , SampleValues ) > 0 ) 
11 and  DateName(minute,SampleTime)%5=0  //时间间隔就是5分钟
12 and  datediff(day,SampleTime,'2017/7/06 0:00:00')=0 // 取时间段为这一天的数据

 

posted @ 2017-08-04 15:09  <--青青子衿-->  阅读(4188)  评论(0编辑  收藏  举报
// /**/ // 在页脚Html代码 引入 // function btn_donateClick() { var DivPopup = document.getElementById('Div_popup'); var DivMasklayer = document.getElementById('div_masklayer'); DivMasklayer.style.display = 'block'; DivPopup.style.display = 'block'; var h = Div_popup.clientHeight; with (Div_popup.style) { marginTop = -h / 2 + 'px'; } } function MasklayerClick() { var masklayer = document.getElementById('div_masklayer'); var divImg = document.getElementById("Div_popup"); masklayer.style.display = "none"; divImg.style.display = "none"; } setTimeout( function () { document.getElementById('div_masklayer').onclick = MasklayerClick; document.getElementById('btn_donate').onclick = btn_donateClick; var a_gzw = document.getElementById("guanzhuwo"); a_gzw.href = "javascript:void(0);"; $("#guanzhuwo").attr("onclick","follow('33513f9f-ba13-e011-ac81-842b2b196315');"); }, 900);