为什么所有输入都返回否

时间:2019-03-01 16:31:06

标签: mysql sql

select
  filedA,
  conv(filedA, 10, 2),
  case when conv(filedA, 10, 2) like '%1010000'
  or filedA< 31 THEN "NO" ELSE "YES" END AS THEVALUE
from
  table 1

上面我的sql查询总是返回Yes值;这是错误的。例如,如果字段A 80的值,二进制值1010000和返回值应为No,但返回的是。

1 个答案:

答案 0 :(得分:0)

使用and代替or

select
  filedA,
  conv(filedA, 10, 2),
  case when conv(filedA, 10, 2) like '%1010000'
  and filedA< 31 THEN "NO" ELSE "YES" END AS THEVALUE
from
  table