返回首页
当前位置: 主页 > 网络编程 > Asp实例教程 >

ASP“本周热门/近期排行”的程序代码

时间:2011-09-07 18:49来源:2018年最新注册送彩金www.zhixing123.cn 编辑:麦田守望者

上一星期(七天之内):
select * from art where [now] between dateadd("ww",-1,now()) and now()
上一星期(上周一至周日):
select * from art where [now] between dateadd("d",-Weekday(Now())-5,now()) and dateadd("d",-Weekday(Now())+1,now())
上一月(上月的今天至今天):
select * from art where [now] between dateadd("m",-1,now()) and now()
上一月(1号至最后一天):
select * from art where [now] between dateserial(year(now),month(now())-1,1) and dateserial(year(now),month(now()),1-1)


'先得到今天是星期几
cweek = WeekDay(now())

sql = "select * from 表 where id > 0"

select case cweek
case 1 '星期天 本周第一天
sql = sql & " and cdate between '" & formartdatetime(now(),2) & " 00:00' and '" & formartdatetime(now(),2) & " 23:59')"
case 2 '星期一
sql = sql & " and cdate between '" & formartdatetime(now()-1,2) & " 00:00' and '" & formartdatetime(now(),2) & " 23:59')"
case 3 '星期二
sql = sql & " and cdate between '" & formartdatetime(now()-2,2) & " 00:00' and '" & formartdatetime(now(),2) & " 23:59')"

...............

case 7 '星期六
sql = sql & " and cdate between '" & formartdatetime(now()-6,2) & " 00:00' and '" & formartdatetime(now(),2) & " 23:59')"

end select
sql = sql & " order by cdate desc"

'以上语句均为MSSQL语句

顶一下
(0)
0%
踩一下
(0)
0%
标签(Tag):asp asp技巧 asp实例教程 asp源代码 asp基础教程
------分隔线----------------------------
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
验证码:点击我更换图片
博聚网