2016-10-11 18 views
0

2つの値(fstValueとlstValue)を返すテーブルに対してクエリを実行しようとしています。 fstValue> = 0かつlstValue < = 100の場合はTrueを返すようにクエリを取得しようとしていますが、他のすべての場合はfalseです。SQLクエリから返された複数の値のチェック

MySQLでこれを行う方法はありますか?

答えて

0
select case when fstValue >=0 AND lstValue <= 100 
      then 'true' 
      else 'false' 
     end as result 
from your_table 
0

この1:

set @firstvalue = 98; 
set @lastvalue = 100; 
select case when (@firstvalue>=0 and @firstvalue<=100) 
and @lastvalue>=0 and @lastvalue<=100 then 'True' 
else 'False' end as '0 to 100'; 
+0

この1 firstvalueとsecondvalueは真の他の0〜100戻りの間にある場合はfalseを返します。 –

関連する問題