tags:

views:

77

answers:

3

how can i change the data in only one cell of a mysql table. i have problem with UPDATE because it makes all the parameters in a column change but i want only one changed.how?

+2  A: 

UPDATE will change only the columns you specifically list.

UPDATE some_table
SET field1='Value 1'
WHERE primary_key = 7;

The WHERE clause limits which rows are updated. Generally you'd use this to identify your table's primary key (or ID) value, so that you're updating only one row.

The SET clause tells MySQL which columns to update. You can list as many or as few columns as you'd like. Any that you do not list will not get updated.

VoteyDisciple
+2  A: 

You probably need to specify which rows you want to update...

UPDATE mytable
    SET column1 = value1,
        column2 = value2
    WHERE key_value = some_value;
Brian Hooper
+1  A: 

update only changes the values you specify

UPDATE table SET cell='new_value' WHERE whatever='somevalue'
gruntled