GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Mysql expert needed... (https://gfy.com/showthread.php?t=576423)

acctman 02-15-2006 01:37 PM

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

Baker Rd 02-15-2006 01:44 PM

are the tables identical?

acctman 02-15-2006 01:47 PM

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

Baker Rd 02-15-2006 01:50 PM

you can try something like this

INSERT INTO rate_members (field1,field2,field3) SELECT field1,field2,field3 FROM phpbb_users

Fresh 02-15-2006 01:52 PM

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.

StuartD 02-15-2006 01:57 PM

Quote:

Originally Posted by Dave Guru
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.

:thumbsup :thumbsup

acctman 02-15-2006 02:03 PM

ok i'll try the php script version, i know enough php to do something small like that. thanks

acctman 02-15-2006 03:40 PM

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

Baker Rd 02-15-2006 04:12 PM

Quote:

Originally Posted by acctman
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

heh, I totally misunderstood your question

FuqALot 02-15-2006 04:27 PM

Quote:

Originally Posted by Dave Guru
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.

Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.

Baker Rd 02-15-2006 04:35 PM

Quote:

Originally Posted by FuqALot
Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.

unless there is data to change I also see no need for this, sql is very powerful and most php programmers hardly know how to do anything but INSERT and SELECT lol

devilspost 02-15-2006 04:42 PM

expertSEXchange.com hehe

Nathan 02-15-2006 04:49 PM

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.

Fresh 02-15-2006 05:43 PM

Quote:

Originally Posted by FuqALot
Only non mysql experts would do that. If you really know mysql you could do it by using a query. Whenever I need stuff done I go to expertsexchange.com, post my question and within minutes i have a query.

to each his own - if one of your buddies at expertsexchange gives you an incorrect query, its gonna fuck shit up

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