Jump to content

add data from one column to another


tengwer

Recommended Posts

I am a beginner with a simple task. I have a table with two columns as follows:Column1: string1, string2, string3Column2: stringA, stringB, stringCI would like this to become:Column1: string1, string2, string3Column2: string1 stringA, string2 stringB, string3 stringCI have tried UPDATE table SET column2 = column1 + column2 but this does not work and only fills column 2 with zeros. Any ideas?

Link to comment
Share on other sites

Try...

UPDATE mytablenameSET column2 = CONCAT(column1,' ',column2)WHERE column1 = 'string1';

...if that works (on the string1 row) then try it without the WHERE clause. If that doesn't work a self-join or sub-query might be needed.

Link to comment
Share on other sites

  • 2 weeks later...

Try...

UPDATE mytablenameSET column2 = CONCAT(column1,' ',column2)WHERE column1 = 'string1';

...if that works (on the string1 row) then try it without the WHERE clause. If that doesn't work a self-join or sub-query might be needed.

It took me a while to get back to this. Unfortunately I get the error "no such function CONCAT"

Link to comment
Share on other sites

Might be helpful if we knew what database you were using.

Sorry. I and trying to alter a MySword data file that is in sql format. MySword is a bible program. The file is a strongs dictionary in sql format that has in column 1 the strongs number and in column 2 the definition. I am trying to get the strongs number to appear along with the definition. I tried using SQLite Personal Edition to run the query. It opens the database fine and I can see everything there but the queries give the errors mentioned above.

Edited by tengwer
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...