仅在video_id中“主机”等于“ cnn”的情况下,您将如何更新send = 1
+----------+---------+------------+--------------+
| video_id | meta_id | upload_key | upload_value |
+----------+---------+------------+--------------+
| 1 | 6 | host | cnn |
| 1 | 7 | send | 0 |
+----------+---------+------------+--------------+
答案 0 :(得分:1)
您可以使用join
:
update t join
t tc
on t.video_id = tc.video_id and
tc.upload_key = 'host' and
tc.upload_value = 'cnn'
set t.upload_value = '1'
where t.upload_key = 'send' and t.upload_value <> '1';