﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>博客园-Mylhei's .NET HOME-最新评论</title><link>http://www.cnblogs.com/mylhei/CommentsRSS.aspx</link><description>mylhei-学习笔记</description><language>zh-cn</language><pubDate>Tue, 15 Nov 2011 06:30:28 GMT</pubDate><lastBuildDate>Tue, 15 Nov 2011 06:30:28 GMT</lastBuildDate><generator>cnblogs</generator><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/12/1978184.html#2045092</link><dc:creator>Fskjb</dc:creator><author>Fskjb</author><pubDate>Sat, 12 Mar 2011 09:21:24 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/12/1978184.html#2045092</guid><description><![CDATA[ 我工作中用的是db2里面有olap函数可以简单的实现类似的功能，不知道sql server里面是否有类似的函数<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">Fskjb</a> 2011-03-12 17:21 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/12/1978184.html#2045092#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/11/1978184.html#2044536</link><dc:creator>mylhei</dc:creator><author>mylhei</author><pubDate>Fri, 11 Mar 2011 08:54:04 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/11/1978184.html#2044536</guid><description><![CDATA[@alxc
对不起，你这段脚本的意思和我描述的意思不一样，您这个是做一个最后的统计，例如你这个3开头的数据，
3	1
3	2
3	3
3	4
您的结果对3进行分组，然后进行求和，而我上面的代码的意思是对于每一条数据都和他上面的数据累加，所以你的结果是：
3 1 0
3 2 0
3 3 0
3 4 0
3 10
我的结果是
3	1	1
3	2	3
3	3	6
3	4	10
这个你可以看一下我上图中的EXCEL公式。
谢谢。<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">mylhei</a> 2011-03-11 16:54 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/11/1978184.html#2044536#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/10/1978184.html#2043675</link><dc:creator>alxc</dc:creator><author>alxc</author><pubDate>Thu, 10 Mar 2011 09:20:13 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/10/1978184.html#2043675</guid><description><![CDATA[@mylhei

表
CREATE TABLE &quot;YAINCOMING&quot;.&quot;TABLE1&quot;
  (
    &quot;COLUMN1&quot; VARCHAR2(20 BYTE),
    &quot;COLUMN2&quot; NUMBER,
  )

数据
REM INSERTING into TABLE1
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;1&#39;,1);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;1&#39;,2);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;2&#39;,1);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;2&#39;,2);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;2&#39;,3);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;3&#39;,1);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;3&#39;,2);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;3&#39;,3);
Insert into TABLE1 (COLUMN1,COLUMN2) values (&#39;3&#39;,4);

查询语句：
select * from(
select column1 项目,to_char(column2) 值,0 总计 from table1 
union all
select column1 项目,null 值,sum(column2) from table1 group by column1) 
order by 项目,值

结果：
项目    值      总计
1	1	0
1	2	0
1		3
2	1	0
2	2	0
2	3	0
2		6
3	1	0
3	2	0
3	3	0
3	4	0
3		10<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">alxc</a> 2011-03-10 17:20 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/10/1978184.html#2043675#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042713</link><dc:creator>qinnan851</dc:creator><author>qinnan851</author><pubDate>Wed, 09 Mar 2011 09:50:17 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042713</guid><description><![CDATA[。。。话说这种我都用代码直接处理数据<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">qinnan851</a> 2011-03-09 17:50 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042713#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042693</link><dc:creator>mylhei</dc:creator><author>mylhei</author><pubDate>Wed, 09 Mar 2011 09:31:43 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042693</guid><description><![CDATA[@alxc
union如何控制条件？愿闻其详！<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">mylhei</a> 2011-03-09 17:31 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042693#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042688</link><dc:creator>mylhei</dc:creator><author>mylhei</author><pubDate>Wed, 09 Mar 2011 09:27:08 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042688</guid><description><![CDATA[@billrobin
上面就是例子啊。<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">mylhei</a> 2011-03-09 17:27 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042688#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042686</link><dc:creator>alxc</dc:creator><author>alxc</author><pubDate>Wed, 09 Mar 2011 09:26:23 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042686</guid><description><![CDATA[利用 union 也可以达到相同的效果<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">alxc</a> 2011-03-09 17:26 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042686#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042573</link><dc:creator>billrobin</dc:creator><author>billrobin</author><pubDate>Wed, 09 Mar 2011 08:21:28 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042573</guid><description><![CDATA[把例子贴出来。。。<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">billrobin</a> 2011-03-09 16:21 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042573#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:巧用sql进行数据累加</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042416</link><dc:creator>SnowToday</dc:creator><author>SnowToday</author><pubDate>Wed, 09 Mar 2011 05:56:44 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042416</guid><description><![CDATA[相信sql server与oracle一样，使用简单的分析函数即可实现此效果。<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">SnowToday</a> 2011-03-09 13:56 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/09/1978184.html#2042416#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Re:asp.net实现页面的局部打印功能实现</title><link>http://www.cnblogs.com/mylhei/archive/2011/03/05/1715812.html#2039011</link><dc:creator>mylhei</dc:creator><author>mylhei</author><pubDate>Sat, 05 Mar 2011 03:03:59 GMT</pubDate><guid>http://www.cnblogs.com/mylhei/archive/2011/03/05/1715812.html#2039011</guid><description><![CDATA[@xm-cck
看一下我下面的回复吧，很简单 ， 主要是上面的代码，其他的很简单。弄个链接 然后指向js函数，还可以在js函数中隐藏当前的超链接。<br><br><div align=right><a style="text-decoration:none;" href="http://www.cnblogs.com/mylhei/" target="_blank">mylhei</a> 2011-03-05 11:03 <a href="http://www.cnblogs.com/mylhei/archive/2011/03/05/1715812.html#2039011#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>
