select 列1||'-'||列2||'-'||列3||'-'||列4 from table oracle数据库
--wm_concat()函数用法 with tb as ( select '王' name,'数学' course, 11 type, '2011-11-30 18:11:00' time from dual union all select '王' , '数学', 11, '2011-11-30 18:11:00' from dual union all select '王' , '语文', 12, '2011-10-30 18:11:00' from dual union all select '张' , '数学', 11, '2011-11-30 18:11:00' from dual ) select tt.name, wm_concat(tt.km), wm_concat(tt.sj) from ( select name, to_char(course), to_char(t.a) as km, to_char(type) || '/' || to_char(to_date(time,'yyyy-mm-dd hh24:mi:ss'), 'mm.dd') as sj from (select name, course, count(1) a, time, type from tb group by name,course,time,type) t ) tt group by tt.name这种问题太多了,WM_CONCAT函数用法,网上一查一大把。
with t as( select 'a' zd1,'b' zd2,'c' zd3,'d' zd4 from dual )select zd1||'-'||zd2||'-'||zd3||'-'||zd4 from t
with tb as (
select '王' name,'数学' course, 11 type, '2011-11-30 18:11:00' time from dual union all
select '王' , '数学', 11, '2011-11-30 18:11:00' from dual union all
select '王' , '语文', 12, '2011-10-30 18:11:00' from dual union all
select '张' , '数学', 11, '2011-11-30 18:11:00' from dual
) select tt.name, wm_concat(tt.km), wm_concat(tt.sj)
from (
select name,
to_char(course),
to_char(t.a) as km,
to_char(type) || '/' || to_char(to_date(time,'yyyy-mm-dd hh24:mi:ss'), 'mm.dd') as sj
from (select name, course, count(1) a, time, type
from tb
group by name,course,time,type) t
) tt
group by tt.name这种问题太多了,WM_CONCAT函数用法,网上一查一大把。
with t as(
select 'a' zd1,'b' zd2,'c' zd3,'d' zd4 from dual
)select zd1||'-'||zd2||'-'||zd3||'-'||zd4 from t
------------------------------
a-b-c-d