SQL sqlite 是否支持选择中的任何类型的 IF(condition) 语句
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1294619/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Does sqlite support any kind of IF(condition) statement in a select
提问by Matt Peters
Does sqlite support the sql function "if" in the select statement?
sqlite是否支持select语句中的sql函数“if”?
for example
例如
select if( length( a ) > 4 , a , ' ') as b
from foo
which would return a if the length was over 4 chars long. or else it would return ' ' as b
如果长度超过 4 个字符,它将返回 a。否则它会返回 ' ' 作为 b
If it does support a condition in the select what is the syntax is should be using?
如果它确实支持 select 中的条件,则应该使用什么语法?
I have checked http://sqlite.org/lang_corefunc.htmlbut I can't see it.
我已经检查过 http://sqlite.org/lang_corefunc.html但我看不到它。