码迷,mamicode.com
首页 > 其他好文 > 详细

使用rtrim()函数来去掉最后一个字符中含逗号的数据

时间:2015-08-25 21:02:19      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:

select * from
(
--租用--
select rownum as 编号,gxrxm as 承租人 ,(case trim(gxrxb ) when ‘1‘ then ‘男‘ when ‘2‘ then ‘女‘ else ‘不详‘ end ) as 性别,
       rtrim( mobilephone ||‘,‘|| LXDH, ‘,‘) as 联系方式 , (select (select gxmc from gxxx where t2. gx= gxdm and rownum= 1) from wrxxb t2
       where t1.djh=djh and rownum=1 and rq=(select min( rq) from wrxxb where t1. djh= djh)) 关系 ,rq as 办理日期 ,‘租用‘ as 业务类型
       --,mwje as 墓价,zmj 成交价,(mwje-zmj) as 优惠金额 ,(SELECT mj FROM mwdmxx WHERE djh=T1.djh) as 面积
       from ywdjb t1 where to_char(rq ,‘yyyy-mm-dd‘)>= ‘2015-07-01‘ and to_char(rq, ‘yyyy-mm-dd‘)<=‘2015-07-31‘   and zxflag= ‘0‘
union all
--续租--
select rownum as 编号,t2.gxrxm  as 承租人 ,(case trim(t2 .gxrxb ) when ‘1‘ then ‘男‘ when ‘2‘ then ‘女‘ else ‘不详‘ end ) as 性别,rtrim( t2.mobilephone|| ‘,‘||t2.LXDH,‘,‘ ) as 联系方式 ,
       (select (select gxmc from gxxx where t3 .gx =gxdm and rownum=1) from wrxxb t3
       where t1.djh=djh and rownum=1 and rq=(select min( rq) from wrxxb where t1. djh= djh)) 关系 ,t1.rq as 办理日期 ,t1 .ywmc as 业务类型
       from qtywb t1 ,ywdjb t2 where t1 .djh =t2 .djh and to_char(t1. rq, ‘yyyy-mm-dd‘)>=‘2015-07-01‘ and
       to_char(t1.rq,‘yyyy-mm-dd‘ )<=‘2015-07-31‘  and t1 .zxflag =‘0‘ and  t1.ywmc= ‘续租‘
union all
--合葬--
select rownum as 编号,t2.gxrxm  as 承租人 ,(case trim(t2 .gxrxb ) when ‘1‘ then ‘男‘ when ‘2‘ then ‘女‘ else ‘不详‘ end ) as 性别,rtrim( t2.mobilephone|| ‘,‘||t2.LXDH,‘,‘ ) as 联系方式 ,
       (select (select gxmc from gxxx where t3 .gx =gxdm and rownum=1) from wrxxb t3
       where t1.djh=djh and rownum=1 and rq=(select min( rq) from wrxxb where t1. djh= djh)) 关系 ,t1.rq  as 办理日期 ,t1 .ywmc as 业务类型
       from qtywb t1 ,ywdjb t2 where t1 .djh =t2 .djh and to_char(t1. rq, ‘yyyy-mm-dd‘)>=‘2015-07-01‘ and
       to_char(t1.rq,‘yyyy-mm-dd‘ )<=‘2015-07-31‘  and t1 .zxflag =‘0‘ and  t1.ywmc= ‘合葬‘
union all
--老墓改造--
select rownum as 编号,t2.gxrxm  as 承租人 ,(case trim(t2 .gxrxb ) when ‘1‘ then ‘男‘ when ‘2‘ then ‘女‘ else ‘不详‘ end ) as 性别,rtrim( t2.mobilephone|| ‘,‘||t2.LXDH,‘,‘ ) as 联系方式 ,
       (select (select gxmc from gxxx where t3 .gx =gxdm and rownum=1) from wrxxb t3
       where t1.djh=djh and rownum=1 and rq=(select min( rq) from wrxxb where t1. djh= djh)) 关系 ,t1.rq as 办理日期 ,t1 .ywmc as 业务类型
       from qtywb t1 ,ywdjb t2 where t1 .djh =t2 .djh and to_char(t1 .rq ,‘yyyy-mm-dd‘)>= ‘2015-07-01‘ and
       to_char(t1.rq,‘yyyy-mm-dd‘ )<=‘2015-07-31‘  and t1 .zxflag =‘0‘ and t1.ywmc= ‘老墓改造‘
)
order by 办理日期

 

使用rtrim()函数来去掉最后一个字符中含逗号的数据

标签:

原文地址:http://www.cnblogs.com/siyunianhua/p/4758305.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!