Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 02-15-2006, 01:37 PM   #1
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
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
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 01:44 PM   #2
Baker Rd
Confirmed User
 
Join Date: Nov 2005
Posts: 647
are the tables identical?
__________________
money talks and bullshit walks.
Baker Rd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 01:47 PM   #3
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
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
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 01:50 PM   #4
Baker Rd
Confirmed User
 
Join Date: Nov 2005
Posts: 647
you can try something like this

INSERT INTO rate_members (field1,field2,field3) SELECT field1,field2,field3 FROM phpbb_users
__________________
money talks and bullshit walks.
Baker Rd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 01:52 PM   #5
Fresh
 
Fresh's Avatar
 
Join Date: Mar 2005
Location: LA
Posts: 4,920
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.
__________________


Promote ONE Legal Tube Site, Collect Checks from 19 Sponsors

Fresh Dave | Email: [email protected] | ICQ: 317160390


Fresh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 01:57 PM   #6
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
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.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 02:03 PM   #7
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
ok i'll try the php script version, i know enough php to do something small like that. thanks
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 03:40 PM   #8
acctman
Confirmed User
 
Join Date: Oct 2003
Location: Atlanta
Posts: 2,840
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
acctman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 04:12 PM   #9
Baker Rd
Confirmed User
 
Join Date: Nov 2005
Posts: 647
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
__________________
money talks and bullshit walks.
Baker Rd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 04:27 PM   #10
FuqALot
Confirmed User
 
Join Date: Dec 2001
Location: Malibu
Posts: 3,817
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.
FuqALot is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 04:35 PM   #11
Baker Rd
Confirmed User
 
Join Date: Nov 2005
Posts: 647
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
__________________
money talks and bullshit walks.
Baker Rd is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 04:42 PM   #12
devilspost
Confirmed User
 
devilspost's Avatar
 
Industry Role:
Join Date: Feb 2004
Location: Tampa yomebe -at- hotmail
Posts: 3,980
expertSEXchange.com hehe
__________________

Brothels and Escorts Worldwide.
devilspost is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 04:49 PM   #13
Nathan
Confirmed User
 
Industry Role:
Join Date: Jul 2003
Posts: 3,108
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.
__________________
"Think about it a little more and you'll agree with me, because you're smart and I'm right."
- Charlie Munger
Nathan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-15-2006, 05:43 PM   #14
Fresh
 
Fresh's Avatar
 
Join Date: Mar 2005
Location: LA
Posts: 4,920
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.
__________________


Promote ONE Legal Tube Site, Collect Checks from 19 Sponsors

Fresh Dave | Email: [email protected] | ICQ: 317160390


Fresh is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.