| Re: how to fusion two database ? |
| by goffy on 2016/2/11 13:25:49 hi cybermongo the problem, maybe, will be, that the storyid you find also in the other tables like stories_files. I would recommend: 1) add a new column "storyid_new" to your table stories 2) Update this column by new storyid, e.g. if the max storyid from the other database is 2000 then run sql le="color: #000000"><?php UPDATE stories SET storyid_new = storyid + 2000; 3) Update the values from the other tables with storyid_new le="color: #000000"><?php UPDATE stories_files a JOIN stories b ON a.storyid = b.storyid SET a.storyid = b.storyid_new 4) do the same with the other tables which are using storyid |
| Re: how to fusion two database ? |
| by cybermongo on 2016/2/7 18:58:59 thnk you Mamba, there are too many record and actually these are not duplicated , the duplicate field is just the "storyid" in this incremente automaticly i will try the script below le="color: #000000"><?php SET @db:='id_new'; select @max_id:=max(AUTO_INCREMENT) from information_schema.tables; select concat('update ',table_name,' set ', column_name,' = ',column_name,'+',@max_id,' ; ') from information_schema.columns where table_schema=@db and column_name like '%id' into outfile 'update_ids.sql'; use id_new source update_ids.sql; i will let you know any news
|
| Re: how to fusion two database ? |
| by Mamba on 2016/2/7 18:29:11 Depending on how many records are duplicate. If the number is small, you could use the "INSERT IGNORE", and then identify the duplicate records that were not inserted, changed manually their ID and then insert them. Or you can follow this advice from StackOverflow: Quote: First, merge in a temporary table, with something like: |
| how to fusion two database ? |
| by cybermongo on 2016/2/7 15:08:58 hi every one, i need your help to join two Database of my two xoops website. the module News create a post with a different ID that make an error when i try to paste de data just in one BD, because this look duplicate, please need your help, how to join these two database in just in one. all the the data are coming from Module news. Cheers guys |