string result = string.Empty; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id and nao_time=Getdate()) *10+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andDATEADD(wk, DATEDIFF(wk,0,getdate()), 7) >=day(nao_time)>DATEADD(wk, DATEDIFF(wk,0,getdate()), 0) *5+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andCONVERT(Day,-1,datetime,convert(char(8),DATEADD(Month,1,getdate()),120)+'1')>=nao_time>=CONVERT(datetime,convert(char(8),getdate(),120+'1') *2+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id and>day(nao_time)>day(Getdate())-60) *1"; result += "desc"; return result; CONVERT(datetime,convert(char(8),getdate(),120+'1') CONVERT(Day,-1,datetime,convert(char(8),DATEADD(Month,1,getdate()),120)+'1') DATEADD(Day,1-DATEPART(Weekday,getdate()),getdate()) DATEADD(Day,7-DATEPART(Weekday,getdate()),getdate()) result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id and nao_time=Getdate()) *10+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andDATEADD(Day,7-DATEPART(Weekday,getdate()),getdate()) >=nao_time>=DATEADD(Day,1-DATEPART(Weekday,getdate()),getdate())) *5+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andCONVERT(Day,-1,datetime,convert(char(8),DATEADD(Month,1,getdate()),120)+'1')>=nao_time>=CONVERT(datetime,convert(char(8),getdate(),120+'1') *2+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id and>day(nao_time)>day(Getdate())-60) *1"; result += "desc"; nao_time BETWEENDateadd(wk,datediff(wk,0,getdate()),-1) ANDDateadd(wk,datediff(wk,0,getdate()),6) result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id and nao_time=Getdate()) *10+ "; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andBETWEENday(nao_time) ANDday(Getdate())-7) *5+"; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andBETWEENday(nao_time) ANDday(Getdate())-30) *2+"; result += "(selectcount(*) from vod_nao where vod_nao.vod_id = vod_info.vod_id andBETWEENday(nao_time) ANDday(Getdate())-60) *1"; result += "desc"; Dateadd(wk,datediff(wk,0,getdate()),-1) --周 Dateadd(wk,datediff(wk,0,getdate()),6) Dateadd(mm,datediff(mm,0,getdate()),0) --月 Dateadd(ms,-3,dateadd(mm,datediff(m,0,getdate())+1,0)) Dateadd(yy,datediff(yy,0,getdate()),0) --年 Dateadd(ms,-3,DATEADD(yy, DATEDIFF(yy,0,getdate())+1, 0)) SELECT vod_info.num_nao, vod_info.num_nao*10+ vod_info.num_nao*5+ vod_info.num_nao*2+ vod_info.num_nao*1as num_naos, vod_nao.nao_time, user_info.user_code FROM vod_info LEFTJOIN vod_nao ON vod_info.vod_id = vod_nao.vod_id LEFTJOIN user_info ON user_info.user_id=upload_user WHERE vod_info.app_status =10AND vod_info.proc_status=10 ORDERBY num_naos DESC SELECT vod_info.num_nao from vod_nao LEFTJOIN vod_info ON vod_info.vod_id = vod_nao.vod_id wheredatediff(dd,upload_time,Getdate())=0 SELECT vod_info.num_nao from vod_nao LEFTJOIN vod_info ON vod_info.vod_id = vod_nao.vod_id wheredatediff(wk,upload_time,Getdate())=1 SELECT vod_info.num_nao from vod_nao LEFTJOIN vod_info ON vod_info.vod_id = vod_nao.vod_id wheredatediff(mm,upload_time,Getdate())=1 SELECT vod_info.num_nao from vod_nao LEFTJOIN vod_info ON vod_info.vod_id = vod_nao.vod_id wheredatediff(mm,upload_time,Getdate())=2 select*from vod_info wheredatediff(dd,upload_time,Getdate())=0 select*from vod_info wheredatediff(wk,upload_time,Getdate())=1--上周 select*from vod_info wheredatediff(mm,upload_time,Getdate())=1--上月 select*from vod_info wheredatediff(mm,upload_time,Getdate())=2--上上月
posted on
2007-02-25 17:39mbskys
阅读(253)
评论(0)
收藏举报