SQL 查询选择 col1, col2, if col3='xx'然后“yy”还有col3,col4 col5???有可能吗?
好吧,我想做一个这样的查询,但我不知道它是否可行
Select
col1,
col2,
col3,
if(contain(col3,'somethingx')) then 'hello' else 'world' as col4,
col5
from table1
换句话说,我想选择
col1
col2
col3
如果 col3
包含单词 'somethingx'
那么我想要选择 'hello' 作为 col4
否则我想从表中选择 'world' 作为 col5
。
well i want to do a query as this but i dont know if it is posible
Select
col1,
col2,
col3,
if(contain(col3,'somethingx')) then 'hello' else 'world' as col4,
col5
from table1
In other words, I want to select
col1
col2
col3
if col3
contains the word 'somethingx'
then I want to select 'hello' as col4
Otherwise I want to select 'world' as col5
from my table.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)