开发者

Update a field to null or delete row if another field is null

开发者 https://www.devze.com 2023-01-22 00:51 出处:网络
I am looking for the most efficient way to update a table in the following way. If fie开发者_Python百科ld A has a value in it and the contents of field b are being removed (null)then just update fiel

I am looking for the most efficient way to update a table in the following way.

If fie开发者_Python百科ld A has a value in it and the contents of field b are being removed (null)then just update field b to null.

If field A has no value in it and field b is being updated to null then delete row.

I'm a MYSQL newbie and am aware of insert/update/delete but am wondering if there is another command that would do the above?


It sounds like you want a trigger.

0

精彩评论

暂无评论...
验证码 换一张
取 消