Oracle 行转列并替换逗号字符

创建会话级临时表
CREATE GLOBAL TEMPORARY TABLE TABLE_test
ON COMMIT PRESERVE ROWS
AS
SELECT statis_date,phonenum,count() as count1 FROM table
where statis_date between ‘20190312’ and ‘20190327’
group by statis_date,phonenum
having count(
)>200
order by count(*) desc

展现数据
select * from TABLE_test order by statis_date desc

行转列并替换,为‘,’
select statis_date,replace(wm_concat(phonenum),’,’,’’|| chr(39) ||’,’|| chr(39) ||’’) from TABLE_test group by statis_date;

完成需求
SELECT * FROM table_3
where statis_date=‘20190312’
and phonenum in (‘18635690881’,‘02691197808’,‘18537377667’,‘13230875765’,‘15905837620’,‘13910907036’,‘13062624414’,‘13168485024’,‘15567694515’,‘30089214415’,‘18635150624’,‘15665723215’,‘13147352414’,‘15588155520’,‘18547100471’,‘13523219668’,‘13181295730’,‘13268418927’,‘13268416102’,‘13072132354’,‘18764774444’,‘13268482809’,‘13959212689’,‘15620739394’,‘18678008893’,‘15666944066’,‘13191955696’,‘13268405517’,‘18595208811’)
order by phonenum,startup_time

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

KennySKwan

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值