|
本帖最后由 lk1822 于 2012-12-15 17:28 编辑
- TRANSFORM Count(商务通.对话类型) AS 对话类型之计数
- SELECT Switch([初次访问网址] Like "*www.srzc.com/*",29,[初次访问网址] Like "*www.zjrb.cn/*",30,[初次访问网址] Like "*www.zsnews.cn/*",31,[初次访问网址] Like "*www.meizhou.cn/*",32,[初次访问网址] Like "*www.tongren.gov.cn/*",33,[初次访问网址] Like "*news.xmnn.cn/*",34,[初次访问网址] Like "*www.beiww.com/*",35,[初次访问网址] Like "*www.lfnews.cn/*",36,[初次访问网址] Like "*www.hljnews.cn/*",37,[初次访问网址] Like "*www.wnnews.cn/*",38,[初次访问网址] Like "*www.sz.js.cn/*",39,[初次访问网址] Like "*www.hynews.net/*",40,[初次访问网址] Like "*www.sxgov.cn/*",41,[初次访问网址] Like "*www.0746news.com/*",42) AS ID, Count(商务通.对话类型) AS 对话类型之计数1
- FROM 商务通
- GROUP BY Switch([初次访问网址] Like "*www.srzc.com/*",29,[初次访问网址] Like "*www.zjrb.cn/*",30,[初次访问网址] Like "*www.zsnews.cn/*",31,[初次访问网址] Like "*www.meizhou.cn/*",32,[初次访问网址] Like "*www.tongren.gov.cn/*",33,[初次访问网址] Like "*news.xmnn.cn/*",34,[初次访问网址] Like "*www.beiww.com/*",35,[初次访问网址] Like "*www.lfnews.cn/*",36,[初次访问网址] Like "*www.hljnews.cn/*",37,[初次访问网址] Like "*www.wnnews.cn/*",38,[初次访问网址] Like "*www.sz.js.cn/*",39,[初次访问网址] Like "*www.hynews.net/*",40,[初次访问网址] Like "*www.sxgov.cn/*",41,[初次访问网址] Like "*www.0746news.com/*",42)
- PIVOT 商务通.对话类型;
复制代码
以上是我自己写的SQL,的确可以达到我想要的统计目的,但是由于字符限制,没法加入更多的查询条件。
不知道有没有办法简化上面的代码,能让我写更多的内容,如能赐教,十分感谢。PS:我使用的是ACCESS2010
|
|