update blank column with mysql php

Asked

Viewed 27 times

0

I need to perform an update in a table but only in columns that are blank and not all, only a specific number.

For example, having this table:

col1 col2 col3 col4 col5 col6 col7
id1  val1 val2 
id2  val1
id3

I intend to update id1, id2, id3 in 2 columns each and would look like this:

col1 col2 col3 col4 col5 col6 col7
id1  val1 val2 val3 val4
id2  val1 val2
id3  val1 val2

What better way if there’s some way to do it...

1 answer

0

The best way to update a blank column is to allow null values (NULL VALUES). Another way may also be to update with a Empty string

Update TableName Set ColumnName='' where [Condtion]   

Browser other questions tagged

You are not signed in. Login or sign up in order to post.