User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MySQL section within the Web Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,795 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MySQL advertiser: Programming Forums
Views: 930 | Replies: 1
Reply
Join Date: Dec 2007
Posts: 1
Reputation: crucialservices is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
crucialservices crucialservices is offline Offline
Newbie Poster

update / replace help

  #1  
Dec 4th, 2007
i currently have a database that someone else created a while ago and i have been tasked with speeding up the data entry and search functionality. currently the database is one table with the following field names:

bid_id = primary key
date_num = date of project
proj_nm = name of project
location_nm = location of project
company_nm = name of company involved
amount_num = amount of bid

now being that a number of these projects are done in the same location or being bid for the same companies i have created seperate tables for the location and company fields.

the new tables for those to fields include just a key and a name.

what i am looking to do is go through the current primary table and replace the records in the location and company fields with the primary key from the corresponding table. i would like to find a way to automate this considering the number of records involved not to mention it would be handy to know anyway. so any and all help is greatly appreciated!!
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2007
Location: North Bay Ontario
Posts: 176
Reputation: trudge is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 20
trudge trudge is offline Offline
Junior Poster

Re: update / replace help

  #2  
Dec 5th, 2007
Assuming you are talking about a MySQL database, have you looked at UPDATE / SET?

For example:
UPDATE your.table 
SET your.field = new.value
WHERE your.field = old.value
Amer Neely - Web Mechanic
"Others make web sites. We make web sites work!"
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MySQL Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the MySQL Forum

All times are GMT -4. The time now is 9:27 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC