tengwer Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
davej Posted April 1, 2014 Share Posted April 1, 2014 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 More sharing options...
JobPencil Posted April 2, 2014 Share Posted April 2, 2014 Try This Also Update tablename Set Name = (ISNULL(columnName1,'') + ' ' + ISNULL(columnrName2,'')) Where colum1='string'; Link to comment Share on other sites More sharing options...
tengwer Posted April 13, 2014 Author Share Posted April 13, 2014 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 More sharing options...
tengwer Posted April 13, 2014 Author Share Posted April 13, 2014 Try This Also Update tablename Set Name = (ISNULL(columnName1,'') + ' ' + ISNULL(columnrName2,'')) Where colum1='string'; This did not work either. I got a near "ISNULL": syntax error Link to comment Share on other sites More sharing options...
davej Posted April 13, 2014 Share Posted April 13, 2014 Might be helpful if we knew what database you were using. Link to comment Share on other sites More sharing options...
tengwer Posted April 13, 2014 Author Share Posted April 13, 2014 (edited) 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 April 13, 2014 by tengwer Link to comment Share on other sites More sharing options...
davej Posted April 13, 2014 Share Posted April 13, 2014 Perhaps you need to copy the data to true SQLite tables. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now