使用typo3扩展通量9.0.1更新colPos [英] Update colPos with typo3 extension flux 9.0.1
问题描述
由于更新流量为9.0.1,所以我需要更新元素的colPos.
Since the update flux to 9.0.1 I need to update the colPos of elements.
这很好:
UPDATE `tt_content`
SET colPos = ((tx_flux_parent * 100) + 11)
WHERE tx_flux_column = "content";
但是我还需要更新本地化的内容元素.它在tx_flux_parent中具有本地化的父uid.但是我需要标准语言的父uid.
But I need also to update the localized content elements. It have in tx_flux_parent the localized parent uid. But I need the parent uid of the standard language.
我需要通过l18n_parent在tt_content中获取值"tx_flux_parent". 因此,我正在尝试使用l18n_parent建立一个查询,如下所示:
I need to get the value "tx_flux_parent" in tt_content by l18n_parent. So I'm trying to build a query with l18n_parent like this:
UPDATE `tt_content` as t1
SET colPos = (( (SELECT t2.tx_flux_parent
FROM tt_content t2
WHERE t1.l18n_parent = t2.uid) * 100) + 11)
WHERE t1.tx_flux_column = "content";
得到这个:
MySQL融合:Dokumentation 1093-表't1'被指定了两次,两者 作为"UPDATE"的目标,并作为数据的单独来源
MySQL meldet: Dokumentation 1093 - Table 't1' is specified twice, both as a target for 'UPDATE' and as a separate source for data
推荐答案
MySQL不允许在另一个子查询中再次引用表正在更新,除非除非它位于FROM
子句(派生表).
MySQL does not allow referencing the table being updated again in another subquery, unless it is inside the FROM
clause (Derived Table).
但是,在这种情况下,您可以使用自加入":
However, in this particular case, you can rather use "Self-Join":
UPDATE `tt_content` as t1
JOIN `tt_content` as t2
ON t1.l18n_parent = t2.uid
SET t1.colPos = ((t2.tx_flux_parent * 100) + 11)
WHERE t1.tx_flux_column = 'content'
这篇关于使用typo3扩展通量9.0.1更新colPos的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!