I have this table in my database, and i need to add 1 each time. unless if it’s null I want to set it to one. I’ve thought of make the default value zero, but i need the zero too.
for example
-----------------------
id number
-----------------------
01 NULL
02 3
03 1
i don’t want to run 2 queries.
QUERY1 : SELECT number and store it in variable
if($number == NULL) $number = 1
else
{
$number = $number++
}
QUERY2 : UPDATE number
is there any 1 SQL Query can do this for me without process the data in php ?
thank’s
That should do the trick.