首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

sql

2012-03-22 
求一个sql一一个页面的统计表(tongji)中有字段urlcountcreatetimeindex.aspx1xxxxxxx1.aspx1xxxxxxx2.aspx

求一个 sql
一一个页面的统计表(tongji)中有

字段
urlcountcreatetime
index.aspx1xxxxxxx
1.aspx1xxxxxxx
2.aspx1xxxxxxx
...
...
...


现在要一次性取得   相应的页面   日访问量,月访问量,和总访问量




[解决办法]
select url,ISNULL(a.[日访问量],0),ISNULL(a.[月访问量],0),ISNULL(a.[总访问量],0) from tburl
left join (
select url,
[日访问量] = case when datediff(d,createtime,getdate()) =0 then [count] else 0 end,
[月访问量] = case when datediff(m,createtime,getdate()) =0 then [count] else 0 end,
[总访问量] = [count]
from tongji) a
on a.url = tburl.url

热点排行