Jump to content


- - - - -

MYSQL query help


  • Please log in to reply
1 reply to this topic

#1 Maynard

Maynard

    Coder

  • Members
  • PipPipPipPipPip
  • 108 posts
  • Location:Finland
  • Real Name:Jarmo
  • IPB Version:v3.2.x

Posted 10 April 2010 - 04:41 PM

I'm updating a database to newer version. As the version in use is very old and also heavily modified there is no automatic update available.
The database tables have changed so much that I'll have to manually copy the data over to the new tables. Most are just plain INSERT INTO... SELECT FROM queries but there is couple of columns that need to be inserted into different table.
First I tried this in 2 separate queries. First the simple copy and then one column from different table. The result was that the second query did put the correct data into correct column, but it created new rows instead of appending them to the existing data.
Then I tried doing this on one query. The query created 1 row which had the proper data and then gave an duplicate id error.
What is the correct way to join the datas and insert into table?

#2 Aloha

Aloha

    Member

  • Members
  • PipPipPip
  • 20 posts
  • Real Name:Alo Ha
  • IPB Version:N/A

Posted 18 April 2010 - 03:24 AM

Edit the files to say replace into instead of insert into. This should take care of the errors.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users