DBrewsky Posted September 15, 2007 Share Posted September 15, 2007 I am trying to change the data in one field based upon data in another field.. mysql > REPLACE INTO zip (state_lg) VALUES ('ARIZONA') WHERE state='AZ'; Basically I am trying to replace a NULL data in one field where data in another field of the same table is equal to a certain value. Is there an easy way to do this, or will I need to extract the data then make the REPLACE statement. I am a newb at this and any help would be appreciative. DBrewsky Link to comment https://forums.phpfreaks.com/topic/69448-solved-attempting-to-replace-data-based-upon-another-field-in-same-table/ Share on other sites More sharing options...
DBrewsky Posted September 15, 2007 Author Share Posted September 15, 2007 UPDATE [table_name] SET [field_name1] = [data1] WHERE [field_name2] = [data2]; This worked beautifully!!! If someone needs a database of all the zip codes, the state, city and county, let me know.. Just got one done.. First real database (52,000 records) I have created... Now how to use all that info... :-\ Link to comment https://forums.phpfreaks.com/topic/69448-solved-attempting-to-replace-data-based-upon-another-field-in-same-table/#findComment-348947 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.