如何插入sybase表查询同一个表

时间:2015-11-26 04:10:40

标签: sybase

我想在表中插入一些已有记录的不同值。我正在使用此命令。

 insert into UserPnlCentre(userId,pnlCentreId,createdUser) values(select userId from UserPnlCentre where pnlCentreId!=4,4,'Migration')

这有什么问题?

1 个答案:

答案 0 :(得分:0)

试试这个:

insert into UserPnlCentre (
        userId
        , pnlCentreId
        , createdUser
)
select  userId
        , 4
        , 'Migration'
from    UserPnlCentre
where   pnlCentreId != 4