0

次の SQL について助けが必要です:-

UPDATE `mg_catalog_category_entity_varchar` AS t1 INNER JOIN `mg_catalog_category_entity`
AS t2 ON t1.`entity_id`= t2.`entity_id`
SET t1.`value` = CONCAT('US Sports Goods ', t1.`value`, ' | My Site Name') 
WHERE t2.`path` LIKE '1/2642%' AND t2.`level` > 1 AND t1.`attribute_id` = 40

私の問題はt1.value、ステートメント内のフィールドがWHERECONCAT()をプルする必要があることであり、ステートメント内でこれを正しく指定する方法を理解するのに苦労しています。t1.valuet1.attribute_id = 35CONCAT()

4

2 に答える 2

0

これを試して:

UPDATE `mg_catalog_category_entity_varchar` AS t1 
INNER JOIN `mg_catalog_category_entity` AS t2 ON t1.`entity_id`= t2.`entity_id`
INNER JOIN
(
   SELECT *
   FROM mg_catalog_category_entity_varchar
   WHERE `attribute_id` = 35
) AS t12 ON t2.entity_id = t12.entity_id 
SET t1.`value` = CONCAT('US Sports Goods ', t12.`value`, ' | My Site Name') 
WHERE t2.`path` LIKE '1/2642%' 
  AND t2.`level` > 1 
  AND t1.`attribute_id` = 40
于 2013-03-21T04:04:29.370 に答える
0

これを試して:

UPDATE `mg_catalog_category_entity_varchar` AS t1 INNER JOIN `mg_catalog_category_entity`
AS t2 ON t1.`entity_id`= t2.`entity_id`
SET t1.`value` = CONCAT('US Sports Goods ', (SELECT t3.`value` FROM `mg_catalog_category_entity_varchar` AS t3 WHERE t3.`attribute_id` = 35 LIMIT 1), ' | My Site Name') 
WHERE t2.`path` LIKE '1/2642%' AND t2.`level` > 1 AND t1.`attribute_id` = 40
于 2013-03-21T03:24:00.397 に答える