1
我想同時更新10列以上,我的問題是我想把所有這些列的where子句。如何在同時更新多個列的同時將多個列放在where子句中?
我的代碼是:
UPDATE Customer AS c
SET
name = a.name,
address= a.address,
telephone = a.telephone,
--
--
--
FROM Customer a
INNER JOIN
(SELECT casenumber
, max(currentDate) AS md
FROM Customer
GROUP BY casenumber
) AS z
ON z.casenumber = a.casenumber
AND z.md = a.currentDate
WHERE (a.casenumber = c.casenumber)
在上述發言中,我要添加條件,以更新的列時,纔不爲0
爲exmple,
UPDATE Customer AS C
SET name = a.name,
address= a.address,
...
..
WHERE a.name <> 0,
a.address <> 0,
a.telephone <> 0
....
...
是有可能把哪裏條件檢查每列?
任何建議都感激..
Thanyou這個解決了我的問題,但你想念CASE後WHEN .. –
謝謝,更正 –