negitve case
-
16 เมษายน 2555 12:19
how do I do this in tsql?
CASE tradeType not 'VANILLA' THEN banksidePremium END AS [BANK PREMIUM]
ตอบทั้งหมด
-
16 เมษายน 2555 12:21
Nearly there, try...
CASE WHEN TradeType <> 'VANILLA' THEN banksidePremium ELSE .... END AS [BANK PREMIUM]
Blog: www.adathedev.co.uk
- ทำเครื่องหมายเป็นคำตอบโดย Quantum Information 16 เมษายน 2555 12:23
-
16 เมษายน 2555 12:21ผู้ตอบ
CASE WHEN TradeType <>'VANILA' THEN ..... END FROM tb'
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/
- แก้ไขโดย Uri DimantMVP, Editor 16 เมษายน 2555 12:21
- ทำเครื่องหมายเป็นคำตอบโดย Naomi NMicrosoft Community Contributor, Moderator 16 เมษายน 2555 12:59
-
16 เมษายน 2555 12:23
Try:
CASE WHEN tradeType <> 'VANILLA' THEN banksidePremium END AS [BANK PREMIUM]
Alternatively:
CASE tradeType WHEN 'VANILLA' THEN NULL ELSE banksidePremium END AS [BANK PREMIUM]
Dan Guzman, SQL Server MVP, http://weblogs.sqlteam.com/dang/
- ทำเครื่องหมายเป็นคำตอบโดย Naomi NMicrosoft Community Contributor, Moderator 16 เมษายน 2555 12:59
-
16 เมษายน 2555 12:24thx all :)
-
16 เมษายน 2555 13:59
for some reason this always returns false:
CASE when tradeType <> 'VANILLA' THEN banksidePremium END AS [BANK PREMIUM],
-
16 เมษายน 2555 14:20
encapsulate the else part also
case when tradetype<>'VANILLA' then banksidepremium else <add the else part here> end as [Bank Premium]
Thanks and regards, Rishabh , Microsoft Community Contributor