开发者

How to write IF(expr1,expr2,expr3) in mssql

There is IF(expr1,expr2,expr3) in my sql.

开发者_Go百科

How to accomplish it in MS SQL?


You can use a CASE expression:

CASE WHEN expr1 THEN expr2 ELSE expr3 END

By the way, this syntax isn't SQL Server specific - it also works in MySQL and most other databases.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜