如何将以下查询转换为JOIN
UPDATE name_master
SET
is_available = 'n',
session_id = '18f05294fab50f30c13eea6304722376'
WHERE
name_id IN (SELECT
*
FROM
(SELECT
nm.name_id
FROM
name_master AS nm
JOIN product_master AS pm ON nm.name_id = pm.product_code
WHERE
nm.is_available = 'y'
AND nm.is_approval_needed = 'n'
AND nm.STATUS = 'active'
LIMIT 1) AS t)
答案 0 :(得分:1)
UPDATE name_master AS nm
JOIN product_master AS pm ON nm.name_id = pm.product_code
SET
nm.is_available = 'n',
nm.session_id = '18f05294fab50f30c13eea6304722376'
WHERE
nm.is_available = 'y'
AND nm.is_approval_needed = 'n'
AND nm.STATUS = 'active'
我看不到来自product_master
的列的任何条件。在这里加入足够的标准吗?
答案 1 :(得分:0)
UPDATE nm
SET
is_available = 'n',
session_id = '18f05294fab50f30c13eea6304722376'
FROM name_master nm
INNER JOIN
product_master pm
ON nm.name_id = pm.product_code
WHERE
nm.is_available = 'y'
AND nm.is_approval_needed = 'n'
AND nm.STATUS = 'active'