根据找到的字符串使用默认值更新字段
Updating fields with default values depending of the finded string
libelle_operation table tblOperation 中的字段是从不完整的外部文件导入的。在某些情况下,该字段包含对应于 tblTiers.id_tiers.
的字符串(本例中为“PADDOCK”)
table tblOperation 中的其他字段(id_tiers、id_type_operation 和 id_categorie_budget)为空,应使用默认值更新(libelle_tiers、 id_type_operation 和 id_categorie_budget)。
Table tblTiers 包含最经常出现的默认值 id_tiers(“PADDOCK”是其中之一)。
数据库的结构是:
table tblTiers 的数据集是:
Table tblOperation 最初包含:
并且在 libelle_operation 和 id_tiers、libelle_tiers 和 id_categorie_budget 中找到“PADDOCK”后应包含此内容,并根据存储在中的默认值设置默认值table tablTiers.
获得此结果的正确 SQL 陈述应该是什么?
id_compte 似乎可以实现部分 link。使用 WHERE 子句提供附加条件以关联记录。
UPDATE tblOperation INNER JOIN tblTiers ON tblOperation.id_compte = tblTiers.id_compte
SET tblOperation.id_tiers = tblTiers.id_tiers, tblOperation.id_type_operation = tblTiers.id_type_operation, tblOperation.id_categorie_budget = tblTiers.id_categorie_budget
WHERE libelle_operation LIKE "*" & libelle_tiers & "*";
libelle_operation table tblOperation 中的字段是从不完整的外部文件导入的。在某些情况下,该字段包含对应于 tblTiers.id_tiers.
的字符串(本例中为“PADDOCK”)table tblOperation 中的其他字段(id_tiers、id_type_operation 和 id_categorie_budget)为空,应使用默认值更新(libelle_tiers、 id_type_operation 和 id_categorie_budget)。 Table tblTiers 包含最经常出现的默认值 id_tiers(“PADDOCK”是其中之一)。
数据库的结构是:
table tblTiers 的数据集是:
Table tblOperation 最初包含:
并且在 libelle_operation 和 id_tiers、libelle_tiers 和 id_categorie_budget 中找到“PADDOCK”后应包含此内容,并根据存储在中的默认值设置默认值table tablTiers.
获得此结果的正确 SQL 陈述应该是什么?
id_compte 似乎可以实现部分 link。使用 WHERE 子句提供附加条件以关联记录。
UPDATE tblOperation INNER JOIN tblTiers ON tblOperation.id_compte = tblTiers.id_compte
SET tblOperation.id_tiers = tblTiers.id_tiers, tblOperation.id_type_operation = tblTiers.id_type_operation, tblOperation.id_categorie_budget = tblTiers.id_categorie_budget
WHERE libelle_operation LIKE "*" & libelle_tiers & "*";