MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 19th, 2004, 02:50 PM
keithh0427 keithh0427 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 1 keithh0427 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
mass update

I have two tables (zipcodes and zones) where I'm attempting to move zones.zone to zipcodes.zone based on a city/state match.

I've tried this but it doesn't seem to work.

UPDATE `zipcodes` set `zipcodes.zone` = `zones.zone` where `zipcodes.city` = `zones.city` and `zipcodes.state` = `zones.state`

Can someone please tell me what I'm doing wrong.

Reply With Quote
  #2  
Old December 20th, 2004, 12:49 PM
Madpawn Madpawn is offline
My beat is correct.
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Posts: 339 Madpawn User rank is Private First Class (20 - 50 Reputation Level)Madpawn User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 2 Days 22 h 3 m 33 sec
Reputation Power: 4
Looks like you need to join your tables:

Code:
   UPDATE 
  `zipcodes`,
  `zones`
 SET
  `zipcodes.zone` = `zones.zone`
 WHERE
  `zipcodes.city` = `zones.city` 
 AND  
  `zipcodes.state` = `zones.state`
 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > mass update


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT