从子查询select语句sql server更新多个列

时间:2013-10-24 06:59:12

标签: sql-server

UPDATE [STAGING_DB_B1].dbo.tempitem
SET newitem = 'Y'
WHERE itemcode COLLATE DATABASE_DEFAULT = * * (
        SELECT DISTINCT n0.itemcode
        FROM [STAGING_DB_B1].dbo.tempitem N0
        WHERE n0.Ordertype = 'SO'
            AND n0.filename = 'SO-TEST1'
            AND DBName = 'DB08TEXG_2'
            AND NOT EXISTS (
                SELECT R0.Itemcode
                FROM DB08TEXG_2.dbo.OITM R0
                WHERE n0.ItemCode = R0.itemcode
                )
        )

子查询返回多个值错误。我该如何解决?

0 个答案:

没有答案