更新 informix 中的表(整个字段)

问题描述 投票:0回答:1

我对 SQL 相当了解,但我现在正在研究 informix,我认为我根本不再了解 SQL。

我有名为“cde”的订单表和名为“art”的文章表,它们由 no_art 列链接。 我想用 art 表中“prin_lieu”列的值更新 cde 表中的“no_lieu”列。

我已经尝试了很多方法,但我已经遇到了同样的错误: SQL 错误 [42000]:发生语法错误。

以下是一些例子:

update 
    cde
set 
    no_lieu = (
    select
        art.lieu_prin
    from
        cde
    left join art on
        cde.no_art = art.no_art)
where
    etat_lig in ('1', '0');
update
    cde
set
    cde.no_lieu = art.lieu_prin
from
    art
where
    cde.no_art = art.no_art
    and cde.no_lieu <> art.lieu_prin;
update
    cde
set
    cde.no_lieu = (
    select
        art.lieu_prin
    from
        art
    where
        cde.no_art = art.no_art
);
update 
    cde
set 
    cde.no_lieu = art.lieu_prin
from 
    cde
inner join 
    art on
    cde.no_art = art.no_art
where
    cde.etat_lig in ('1', '0');

感谢您的帮助,

sql informix
1个回答
0
投票

--这对我有用...... 更新cde 设置 cde.no_lieu = ( 选择 art.lieu_prin 来自艺术 其中 cde.no_art = art.no_art ) 在哪里 cde.etat_lig in ('1', '0') 和 存在(选择“我是 groot” 来自艺术 其中 cde.no_art = art.no_art ) ;

-- 更新了 1 行。

© www.soinside.com 2019 - 2024. All rights reserved.