Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 5th, 2012  |  syntax: None  |  size: 0.29 KB  |  hits: 10  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. how to update table based on another table in mysql?
  2. users
  3. zip      state      city
  4. 89012    
  5. 45869     0
  6. ....
  7.  
  8.  
  9. zips
  10. zip      state      city
  11. 89012    NV         lv
  12. 45869    MI         ca
  13. ....
  14.        
  15. update users u
  16.   inner join zips z on z.zip = u.zip
  17. set u.state = z.state,
  18.   u.city = z.city;