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.
精彩评论