将一个 table 中的列替换为另一个 table 中的同名列

Replace column in one table with a column with the same name from another table

我正在尝试用另一个 table

中的同名列替换一个 table 中的列

下面的查询给出了一个错误 Column item_name in SELECT * REPLACE list is ambiguous at [6:38]

WITH items AS (
    SELECT 1 as item_id, "sprocket" as item_name),
orders AS (
    SELECT 123 as order_id, 1 as item_id, "ff" as item_name)

SELECT * REPLACE (items.item_name AS item_name)
FROM orders
JOIN items on orders.item_id  = items.item_id

当我尝试通过将 (items.item_name AS item_name) 更改为 (items.item_name AS orders.item_name) 来解决歧义时,它会引发不同的错误:Syntax error: Expected ")" or "," but got "." at [6:44]

SELECT * REPLACE (items.item_name AS orders.item_name)
    FROM orders
    JOIN items on orders.item_id  = items.item_id

在 table 之一中将要替换的列的名称从 item_name 更改为 item_name_1 的解决方法有效,但为什么它在标准 [=21 上失败了=] REPLACE

中的语法
WITH items AS (
    SELECT 1 as item_id, "sprocket" as item_name),
orders AS (
    SELECT 123 as order_id, 1 as item_id, "ff" as item_name_1)

SELECT * REPLACE (items.item_name AS item_name_1)
FROM orders
JOIN items on orders.item_id  = items.item_id

下面使用

WITH items AS (
    SELECT 1 as item_id, "sprocket" as item_name),
orders AS (
    SELECT 123 as order_id, 1 as item_id, "ff" as item_name)

SELECT orders.* REPLACE (items.item_name AS item_name)
FROM orders
JOIN items on orders.item_id  = items.item_id