Jump to content

[SOLVED] Attempting to replace data based upon another field in same table


DBrewsky

Recommended Posts

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

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...  :-\

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.