我希望我能够清楚地解释这一点:在我们的Magento数据库中,我有以下两个查询我需要合并(我是一个SQL新手):
update catalog_product_entity_text
set `value` = CONCAT('', `value`)
where entity_id in (select product_id from catalog_category_product where category_id = 975)
and attribute_id = 57;
select `value` from catalog_product_entity_text
where entity_id in (select product_id from catalog_category_product where category_id = 571)
and attribute_id = 551;
第一个查询中CONCAT函数中的空白值需要包含第二个查询中与循环中当前entity_id对应的值。
我是如何做到这一点的呢?非常感谢。
更新:我正在读取连接,看起来好像是同一个表上的左外连接,但我仍然不清楚正确的语法和利用率。
这是一份甚至无法通过的草稿:
select `value` from catalog_product_entity_text
as mobile_description
where attribute_id = 551
and entity_id in (select product_id
from catalog_category_product
where category_id = 571)
join on entity_id;
如何改进以使其有效?
我正在尝试使用attribute_id = 57& attribute_id = 551,从具有相同entity_id的那些中获取每个value
列,以便我可以使用attribute_id = 57更新行的value
以包含具有attribute_id的相应记录的值= 551。
答案 0 :(得分:0)
我想说类似的东西应该有效。当然是先备份数据库。这是纯粹的SQL问题。
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://localhost:8888/rip-access/wp-content/themes/RIP/assets/css/style.css" type="text/css" media="all">
<button id="css_toggle" title="I'm a tooltip!">Text</button>
如果它不起作用,请告诉我,但您可以快速查看this answer