这实际上是一种更新为特定客户工作的团队成员的表格,当我取消选择成员时,状态变为0
。
我有一个包含所有唯一记录的表。表格由四列组成-
first column is `id` which is unique and auto_incremented.
second column is `client_id`.
third column is `member_id`. (these second and third columns together make the primary key.)
fourth column is `current` which shows the status (default is 1.).
现在我有它发送的值的形式client_id
和member_id
。但是此表单还包含表中已经存在的值BUT NOT ALL
。
我需要一个查询
(i) `INSERT` the values that are not already in the table,
(ii) `UPDATE` the `current` column to value `0` which are in the table but not in the form values.
这是我的表格的屏幕截图。
如果(从您的表中选择count(*),其中client_id =和member_id =)> 0 THEN
更新yourtable设置current = 0;
别的
插入您的表(client_id,member_id,当前)值(值1,值2,值3)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句