I have a table in sql in I have to columns, which are name; Qty Desc. Is there are way I can combine the two row together on another column?
Example:
Qty Desc Combine
4 Test 4Test
11 Issue 11Issue
Printable View
I have a table in sql in I have to columns, which are name; Qty Desc. Is there are way I can combine the two row together on another column?
Example:
Qty Desc Combine
4 Test 4Test
11 Issue 11Issue
What flavour of SQL is it?
This might do it...
select Qty, Desc, Cast(Qty as varchar)+Desc as Combine from...
look at concat or the equivalent for your SQL you are using. It allows you to add or remove digits or whole words. you might be able to use that to create or if I understand correctly use the JOIN statement.
SQL Server
select Qty, Desc, Qty + Desc as combine
assumining Qty is numeric
select Qty, Desc, convert(varchar,Qty) + Desc as combine
or
select Qty, Desc, convert(varchar,Qty) + Desc 'combine'
Oops...someone beat me to it.
Thanks