SQL之多个字段拼接

 

#第一种仅做多个字段拼接
select bid || ocpc_level_desc || pay_mode_desc AS fem_bid from fem_baidu_adgroup
#用concat函数多个字段拼接
select concat(bid,ocpc_level_desc,pay_mode_desc)AS fem_bid from fem_baidu_adgroup
#用concat函数并且/分隔
select concat(bid,'/',ocpc_level_desc,'/',pay_mode_desc)AS fem_bid from fem_baidu_adgroup
#用concat函数 case when判断值是否为空不为空时用/分隔
concat(bid,(case ocpc_level_desc when '' then ''else '/'end),ocpc_level_desc,(case pay_mode_desc when '' then ''else '/'end),pay_mode_desc) AS fem_bid,

 

上一篇:php 微信公众号接入支付宝支付


下一篇:微信小程序开发入门教程(三)---小程序云开发支付功能