Click here to Skip to main content
15,892,575 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Comments
aarif moh shaikh 24-Sep-15 4:10am    
select yourcolumn1 + yourcolumn2 as myNewcolumn from Yourtable

1 solution

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

You may take into consideration the following scenarios:
1. Trimming[^] values.
2. ISNULL[^] values.
 
Share this answer
 
v3
Comments
aarif moh shaikh 24-Sep-15 4:10am    
agree with you

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900