什麼是=1
在這裏做?sql server sql case
SELECT TOP 3
NewsId,
NewsTitle,
NewsContent
FROM disc_News
WHERE CASE
WHEN DatePublish IS NOT NULL and DateExpired IS NOT NULL THEN 1
ELSE 0
END = 1
什麼是=1
在這裏做?sql server sql case
SELECT TOP 3
NewsId,
NewsTitle,
NewsContent
FROM disc_News
WHERE CASE
WHEN DatePublish IS NOT NULL and DateExpired IS NOT NULL THEN 1
ELSE 0
END = 1
1只是使整個表達式評估爲真或假。 where子句應該用於評估布爾表達式,否則您將會遇到語法錯誤
它會讓您獲取DatePublish和DateExpired爲NOT NULL的記錄。
以下WHERE
條款應相當於
WHERE DatePublish IS NOT NULL
AND DateExpired IS NOT NULL