•
•
•
•
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
![]() |
•
•
Join Date: Dec 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
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!!
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!!
•
•
Join Date: Sep 2007
Location: North Bay Ontario
Posts: 176
Reputation:
Rep Power: 2
Solved Threads: 20
Assuming you are talking about a MySQL database, have you looked at UPDATE / SET?
For example:
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!"
"Others make web sites. We make web sites work!"
![]() |
•
•
•
•
•
•
•
•
DaniWeb MySQL Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- need help finding a script or tool to use for a news update program. (PHP)
- ActiveX-how can fix/replace them? (Windows 9x / Me)
- Boot Problems after bios update (Troubleshooting Dead Machines)
- Need update query--Remove the coma "," (PHP)
- stupid string replace! (c++) (C++)
- Update to completly lost : ) (Java)
- update oracle column but bot replace (ColdFusion)
- Password (Visual Basic 4 / 5 / 6)
- New server to replace old W2K DC server (Windows NT / 2000 / XP / 2003)
- explorer.exe?? (Windows NT / 2000 / XP / 2003)
Other Threads in the MySQL Forum
- Previous Thread: New to databases
- Next Thread: select query


Linear Mode