sqlserver将两列合并,如何合并sql中的两列

My query as follows

select BatchID = (select eid from BATCHID where bid = 'B16401' and b_activ = <>'d'

Cid = (select top 1 certificate_no from certificate_detail where stud_id = a.stud_id and active = 'A' and crsname = 'ctf' )

from student a, course_registration b, batch_course_registration c where

a.stud_id=b.stud_id and b.cr_bill_no=c.cr_bill_no

and c.bcr_batch_id='B16401' and b.cr_active='A' and a.stud_active<>'D'

Wheni exeucte the above query output as follows

Batchid Cid

CTF/B376 09

I want to combine the above batchid and Cid and get the output as follows

Batchid Cid Batch

CTF/B376 09 CTF/B376/09

for that how can i combine the two columns in sql server

解决方案Adapt:

select column1, column2, column1 + '/' + column2 newcolumnname from tablename

You may take into consideration the following scenarios:

1. Trimming[^] values.

2. ISNULL[^] values.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值