I have a table that have 3 columns: ID Name ID_Name 1 Lisa 2 John 3 Marri
I want to combine the ID column and Name column and put that result in ID_Name column ( ex: 1Lisa, 2John, etc.) What SQL statement will give me that result?
THanks
update table set id_name=id||name;
Or something like that.
Scott,
I tried but it give me the following error:
Error converting data type varchar to numeric.
What do I need to do? THanks.
Sesame
You probably need to cast your types. What dbms are you using by the way, some of them don't use SQL syntax for concatenation as well.
Try this:
update table set field3=field1::varchar||field2::varchar
or something like that.
It looks like you're trying to concatenate them into a numeric field, you need to be putting them into something like a varchar field.