I was wondering how to update a field with a negative increment but if the new value is less than 1 delete the row instead?
Is it possible to put and update statement inside an case or if/else block?
Currently I am doing a select statement to get the current value, then evaluating with php and doing a second query:
if ($row['field']==1) {
"DELETE from table WHERE k='123'"
} else {
"UPDATE table SET field=(field-1) WHERE k='123'"
}
just wondering if you could do this in one query?
Do you want something like this??????