[英]Equivalent of IFF in Case SQL statement
I am trying to convert an access IFF query to an SQL Server query 我正在尝试将访问IFF查询转换为SQL Server查询
SELECT blah blah ,
IIf([stock]![supplier]=[pos]![supplier],"Preferred"," ") AS Preferrednew
FROM blah blah
In access this will give a value of preferred in a column called Preferrednew where the condition is true. 在访问中,这将在条件为true的称为Preferrednew的列中提供preferred的值。
I have converted the code to.. 我已将代码转换为
SELECT blah blah ,
CASE WHEN ([stock.supplier] = [pos.supplier]), 'test', 'test2' AS [preferrednew]
FROM blah blah
but I get the error 但是我得到了错误
Incorrect syntax near ',' ','附近的语法不正确
What is the correct format ? 正确的格式是什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.