江清风 2017-05-23 01:47 采纳率: 0%
浏览 1757
已结题

oracle数据库中,要求不能用wm_concat函数合并值

问题:oracle数据库中,要求不能用wm_concat函数,合并值,希望得到结果如下:
s_type s2
水果 葡萄,哈密瓜,香瓜,火龙果
蔬菜 西兰花,茼蒿,茄子
坚果 核桃,巴旦木

数据如下:
create table t_thz_1(
n_id number(10),
s_mc varchar2(100),
s_type varchar2(10)
);

truncate table t_thz_1;
insert into t_thz_1(n_id,s_mc,s_type)
select 1 n_id,'葡萄' s_mc,'水果' s_type from dual union all
select 2 n_id,'哈密瓜' s_mc,'水果' s_type from dual union all
select 3 n_id,'西兰花' s_mc,'蔬菜' s_type from dual union all
select 4 n_id,'核桃' s_mc,'坚果' s_type from dual union all
select 5 n_id,'茼蒿' s_mc,'蔬菜' s_type from dual union all
select 6 n_id,'香瓜' s_mc,'水果' s_type from dual union all
select 7 n_id,'巴旦木' s_mc,'坚果' s_type from dual union all
select 8 n_id,'茄子' s_mc,'蔬菜' s_type from dual union all
select 10 n_id,'火龙果' s_mc,'水果' s_type from dual
;
commit;

  • 写回答

2条回答 默认 最新

  • wangwx0824 2017-05-23 06:30
    关注

    select s_type,wm_concat(s_mc) as s_mc from t_thz_1 group by s_type,s_type

    评论

报告相同问题?

悬赏问题

  • ¥15 求chat4.0解答一道线性规划题,用lingo编程运行,第一问要求写出数学模型和lingo语言编程模型,第二问第三问解答就行,我的ddl要到了谁来求了
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥15 maple软件,用solve求反函数出现rootof,怎么办?
  • ¥65 汇编语言除法溢出问题
  • ¥15 Visual Studio问题
  • ¥20 求一个html代码,有偿
  • ¥100 关于使用MATLAB中copularnd函数的问题
  • ¥20 在虚拟机的pycharm上
  • ¥15 jupyterthemes 设置完毕后没有效果