0
繼續我的Coldfusion和學生認證模塊系列,我想出了一些問題。SQL Server 2008:DateDiff返回一個忽略值
當我使用下面的查詢返回Coldfusion的值時,我得到了negitave和postive日期。
我需要做的是返回日期只有大於或等於今天,所以如果cprAdultExp是2/27/2011,我需要將該值返回爲25,而如果kidExp是1/2/2011我需要它沒有任何回報。
有什麼想法?
SQL:
SELECT
p.firstName,
p.lastName,
m.profileID,
dateDiff(day,getDate(),m.cprAdultExp) as adultExp,
dateDiff(day,getDate(),m.cprInfantChildExp) as kidExp,
dateDiff(day,getDate(),m.cprFPRExp) as frpExp,
dateDiff(day,getDate(),m.aedExp) as aExp,
dateDiff(day,getDate(),m.firstAidExp) as aidExp,
dateDiff(day,getDate(),m.emtExp) as eExp,
dateDiff(day,getDate(),m.waterSafetyInstructionExp) as waterExpt,
dateDiff(day,getDate(),m.bloodPathogensExp) as bloodExp,
dateDiff(day,getDate(),m.oxygenAdminExp) as oxyExp,
dateDiff(day,getDate(),m.lifegaurdingExp) as lifeExp,
dateDiff(day,getDate(),m.wildernessResponderExp) as wildExp,
m.certNotes
FROM
pro_Profile p
LEFT JOIN mod_StudentCertifications m
ON
m.profileID = p.profileID
WHERE
p.isDeleted='False'
有沒有理由不能在你的`WHERE`子句中包含條件? – Matthew 2011-02-02 17:14:28