Current location: Hot Scripts Forums » Programming Languages » PHP » Replicating table MySQL values


Replicating table MySQL values

Reply
  #1 (permalink)  
Old 01-05-04, 12:58 PM
lordmerlin lordmerlin is offline
Newbie Coder
 
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Cool Replicating table MySQL values

Hi

I have two tables, companies and tradealerts.
Companies has about 25 fields, and currently about 24700 odd entries.
tradealerts has 9 fields, and rougly about 290 entries.
The only similarity between the two is a field called compid (which is the company id), countryid and classification.

Now, I want all the records in the companies table to be in the tradealerts table, but I'm just not sure howto do this.

I had a look on the mysql website, and I couldn't see anything in this line, other than update, like this:

UPDATE companies,tradealerts SET tradealerts.classifications=companies.classificati ons

This is all good and well, but it doesn't work for me. I want all 24700 odd records to be duplicated into the tradealerts table.

Almost like:

INSERT into tradealerts(compid,classifications,countryid) VALUES ("companies.compids","companies.classifications",c ompanies.coutryid")

Is there a way of doing this?
Reply With Quote
  #2 (permalink)  
Old 01-05-04, 03:42 PM
SIR-Millar SIR-Millar is offline
New Member
 
Join Date: Dec 2003
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
if this is a one off, perhaps consider making a PHP script to copy from one to another?
Reply With Quote
  #3 (permalink)  
Old 01-06-04, 11:15 AM
lordmerlin lordmerlin is offline
Newbie Coder
 
Join Date: Jul 2003
Location: South Africa
Posts: 94
Thanks: 0
Thanked 0 Times in 0 Posts
Well, not really, cause quite soon we'll be uploading a few more entried to the database, and then in a few months time again. The data get's generated by another company, and we get it in batches of a few thousand at a time.

So yes, the script sounds like a good idea, but how do I write it? The main consern is that it should skips rows where companies.compid = tradealets.compid.

Do you maybe have a suggestion as howto make this script? Or even just a scrpt to copy it over?
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP and MySQL ? rob2132 Hot Scripts Forum Questions, Suggestions and Feedback 4 08-29-08 02:22 AM
Getting a function to return a MySQL table row.. Axe PHP 6 09-07-04 06:46 AM
mySQL: selecting values that do not exist bitesize PHP 9 02-20-04 11:47 AM
mysql table wcfoone PHP 0 12-18-03 12:31 PM
Autonum in mysql table pk_jsp PHP 1 10-11-03 04:32 PM


All times are GMT -5. The time now is 08:20 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.