ldcf.net
当前位置:首页 >> 求助,orAClE多行数据合并成一行 >>

求助,orAClE多行数据合并成一行

需要用wm_concat函数来实现。 如目前在emp表中查询数据如下: 要按照deptno相同的将ename以字符串形式合并,可用如下语句: select deptno,wm_concat(ename) from emp group by deptno;查询结果:

你看看是不是这样的,你数据排版太混乱了 select csrq,qyph,pczl,wm_concat(jyxmmc),wm_concat(jyz),xydj,je from 表名 group by csrq,qyph,pczl,xydj,je ----------补充----------- oracle跟sqlserver不一样,如果存储过程的话只能返回类似sqls...

固定只显示2个子女的信息: A、要两个子女以上的才显示 with tmp1 as (select b.person_id as id,b.name||':'||b.sex childs from B b where b.person_id in (select a.person_id from B a group by a.person_id having count(a.id)>1) ) select...

利用分组max。

select id ,listagg( name, ',' ) within group ( order by id ) as name from TABLE_NAME GROUP BY id;

select a.PUSH_CODE, a.PROVINCEPUDATE, a.provinceRECEIVERNAME, b.CITYPUDATE, b.CITYRECEIVERNAME from table1 a, table2 b where a.PUSH_CODE=b.PUSH_CODE

你好,你最后怎么解决的?我现在也有这个问题。

可以考虑使用wmsys.wm_concat方法,该方法是将记录的值使用逗号间隔拼接 使用方法如下: select wmsys.wm_concat(name) name from idtable; NAME ---------- --------------------------------------------------------------------------------...

select name, sum(results1), max(free) from a where name = "A" ;

select changedate,annualsalarycount,annualsalary,dloatannual,monthannual, lag(changedate)over(order by changedate), lag(annualsalarycount)over(order by changedate), lag(annualsalary)over(order by changedate), lag(dloatannual)ov...

网站首页 | 网站地图
All rights reserved Powered by www.ldcf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com