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

Link to comment
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.