![]() |
Mysql expert needed...
does anyone know how to merge to tables? Table1_members needs to receive all the fields and setting in Table2_users. anyone know hwo to do this merge either via shell or phpmyadmin
|
are the tables identical?
|
no not identical. they're both in the same database though. one is rate_members and the other is phpbb_users. i need all the fields with there settings from phpbb_users (with the exception of username and user_id, i'll drop those fields) moved/copied to rate_members.
i've check both tables and there won't be a overlapping problem since all fields in phpbb_users are unique |
you can try something like this
INSERT INTO rate_members (field1,field2,field3) SELECT field1,field2,field3 FROM phpbb_users |
the way we would do it is first create a duplicate of the destination via phpmyadmin (operations>copy table with data/structure) then write a simple php script to read the one you want to merge, and as you loop thru the results, import to the duplicate version passing only the variables that are required to make the entry valid in the copy. Once you confirm the data is correct, u can rename the tables via the same way (operations>rename) and make it live without any hiccups.
|
Quote:
|
ok i'll try the php script version, i know enough php to do something small like that. thanks
|
i did some research looks like i need to use ALTER to add to an existing table
ALTER TABLE table_name ADD column_name datatype |
Quote:
|
Quote:
|
Quote:
|
expertSEXchange.com hehe
|
The real question here is: why in gods name do you want to do that?!
Either learn how to do joins, or if you use mysql 5, setup a damn view. |
Quote:
the safest way of going about it is as i described. |
| All times are GMT -7. The time now is 01:55 AM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123