如何使用这种结构更新关系表:
- especie_id
- multimedia_id
- isCover
设置isCover
= 1
此查询的结果匹配时:
SELECT id as multimedia_id, substring_index(substring_index(pathURL, '.', -3),'.', 1) as especie_id
FROM multimedias
WHERE tipo_multimedia_id = 31
我需要内部联接吗?
谢谢!
答案 0 :(得分:2)
您应该能够像这样进行UPDATE
:
UPDATE table1
SET isCover = 1
WHERE (multimedia_id, especie_id) IN (SELECT id as multimedia_id,
substring_index(substring_index(pathURL, '.', -3),'.', 1) as especie_id
FROM multimedias
WHERE tipo_multimedia_id = 31)