发表时间:2010-09-30
yipbxx 写道 JE论坛频道显示的积分怎么和问答频道显示的积分不一致?
论坛积分是论坛积分。 问答积分是问答积分。 不一样的。 还有就是积分有用么? 显得自己很牛? CSDN来的? |
|
发表时间:2010-09-30
create table tab1(a varchar2(16),b varchar2(16));
insert into tab1 values('a','1'); insert into tab1 values('a','2'); insert into tab1 values('a','3'); insert into tab1 values('b','4'); insert into tab1 values('b','5'); commit; SELECT A, LTRIM(MAX(SYS_CONNECT_BY_PATH(B, ',')), ',') B FROM (SELECT A, B, row_number() over(PARTITION BY A ORDER BY A, B) M, (ROW_NUMBER() OVER(ORDER BY A, B) + (DENSE_RANK() OVER(ORDER BY A))) NUMID FROM (SELECT A, B FROM tab1)) START WITH M = 1 CONNECT BY NUMID - 1 = PRIOR NUMID GROUP BY A |
|
发表时间:2010-09-30
create table tab1(a varchar2(16),b varchar2(16));
insert into tab1 values('a','1'); insert into tab1 values('a','2'); insert into tab1 values('a','3'); insert into tab1 values('b','4'); insert into tab1 values('b','5'); commit; SELECT A, LTRIM(MAX(SYS_CONNECT_BY_PATH(B, ',')), ',') B FROM (SELECT A, B, row_number() over(PARTITION BY A ORDER BY A, B) M, (ROW_NUMBER() OVER(ORDER BY A, B) + (DENSE_RANK() OVER(ORDER BY A))) NUMID FROM (SELECT A, B FROM tab1)) START WITH M = 1 CONNECT BY NUMID - 1 = PRIOR NUMID GROUP BY A oracle9i上面测试通过。 |
|
发表时间:2010-09-30
select t.filed1,wmsys.wm_concat(t.filed2) from table t group by t.filed1oracle 10g 测试用过。 |
|
发表时间:2010-09-30
oracle 支持多个分组,但是连接字段小于4000字符
SELECT t.filed1, MAX(substr(sys_connect_by_path(t.filed2, ','), 2)) str FROM table1 t START WITH filed2= 1 CONNECT BY filed2= PRIOR filed2+ 1 AND filed1= PRIOR filed1 GROUP BY t.filed1; |
|
发表时间:2010-09-30
finallygo 写道 select field1,group_concat(field2) as all from table group by field1
select field1,group_concat(field2) as 'all' from table group by field1 |
|
发表时间:2010-09-30
asgab 写道
select t.filed1,wmsys.wm_concat(t.filed2) from table t group by t.filed1oracle 10g 测试用过。 google 搜索 行列转换 函数,应该有你想要的结果 |
|
发表时间:2011-01-06
WMSYS.WM_CONCAT支持的字符串的最大长度是4000,如果超过4000有什么好办法吗?
|
|
发表时间:2011-01-13
oracle数据库sql
方法1: select (select distinct field1 from tablename) field1,(select field2||',' from tablename where field2='1')|| (select field2||',' from tablename where field2='2')||(select field2 from tablename where field2='3') all from dual 方法2: select distinct field1 , MAX(decode(field2, '1',field2 || ',', NULL)) || MAX(decode(field2, '2', field2 || ',', NULL)) || MAX(decode(field2, '3', field2)) from tablename where field1='A' group by field1 |
|
发表时间:2011-02-26
用oracle怎么都得用函数来解决,还不如自己写个函数,wm_sys.concat这个函数返回值是clob型的,长度问题倒是不用考虑。
|