Click here to Skip to main content
16,020,622 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey guys,

select CarID [ID],CarName [Name],CarNumber from VehicleMaster where CarStatus=0

this is my query

i want to merge to column value in one column. i want to carnumber and carname in on column "-"
Posted

Try:
SQL
SELECT CarNumber + '-' + CarName AS [Name and number] FROM VehicleMaster
 
Share this answer
 
In Oracle
==============
SQL
select CarID [ID]||'-'||CarName [Name],CarNumber from VehicleMaster where CarStatus=0


in Sql
=======
SQL
select CarID [ID]+'-'+CarName [Name],CarNumber from VehicleMaster where CarStatus=0
 
Share this answer
 
select carid,carnumber +'-'+ carname as a from vehicle master where carstatus=0
 
Share this answer
 
you might use the Sql join query
check these links
<a href="http://www.tizag.com/sqlTutorial/sqljoin.php">http://www.tizag.com/sqlTutorial/sqljoin.php</a>[<a href="http://www.tizag.com/sqlTutorial/sqljoin.php" target="_blank" title="New Window">^</a>]
 
Share this answer
 
Comments
Vijay Kr Sharma 18-Jan-12 6:00am    
Will you please tell me what is the need of join here he wants to join two columns of the same table.

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