开发者

If condition in select query

开发者 https://www.devze.com 2023-03-06 19:48 出处:网络
select email from mailing list This is the query i want to use if condition. I have a column in mailing list as 开发者_StackOverflow社区unsub. If this unsub is true the email should null in the sele
select email from mailing list

This is the query i want to use if condition. I have a column in mailing list as 开发者_StackOverflow社区unsub. If this unsub is true the email should null in the selected result otherwise the email will be the selected result


select case unsub when true then null else email end as email,....
from ...

see the docs for more examples.

0

精彩评论

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

关注公众号