小编Reu*_*uta的帖子

MySQL where语句基于if

嗨,我正在从以下逻辑制作MySQL语句.

Select * from content 
if(description=='educational')
where serial like '%EDU2015%'
else where serial like '%NOVEL2015%'
Run Code Online (Sandbox Code Playgroud)

逻辑很简单,如果说明列是教育性的,那么过滤器应该有字符串"EDU2015.否则,它应该使用"NOVEL2015"的序列进行过滤

我不确定我是否使用在mysql中使用IF语句的方式,但我不知道在哪里放置来自https://dev.mysql.com/doc/refman/5.7/en/if.html的where语句

mysql if-statement where-clause

2
推荐指数
2
解决办法
5089
查看次数

标签 统计

if-statement ×1

mysql ×1

where-clause ×1