我得到了我想要的项目:
SELECT
ORDRE.NO_ORDRE
,ORDRE.CODE_CLIENT
FROM [Soft8Exp_Client].[dbo].[ORDRE]
where DATEPART(YEAR,ORDRE.DATE_CLOTUR_REEL) = 2014
and DATEPART(MONTH,ORDRE.DATE_CLOTUR_REEL) = 4
and DATEPART(DAY,ORDRE.DATE_CLOTUR_REEL) = 29
EXCEPT
SELECT
[NO_ORDRE]
,[CODE_CLIENT]
FROM [Soft8Exp_Client].[dbo].[LETTRE_VOIT]
where DATEPART(YEAR,DATE_CLOTUR_REEL) = 2014
and DATEPART(MONTH,DATE_CLOTUR_REEL) = 4
and DATEPART(DAY,DATE_CLOTUR_REEL) = 29
现在我怎么能把它放到UPDATE命令中?
UPDATE [Soft8Exp_Client].[dbo].[ORDRE]
SET STATUS = 1
WHERE ??
答案 0 :(得分:1)
我不太确定,你想做什么。你想要这个吗?
UPDATE [Soft8Exp_Client].[dbo].[ORDRE] o
SET o.STATUS = 1
FROM (
-- Your query from the top of your question
) t
WHERE o.NO_ORDRE = t.NO_ORDRE AND o.CODE_CLIENT = t.CODE_CLIENT;