簡體   English   中英

檢查從SQL查詢返回的多個值

[英]Checking multiple values returned from an sql query

我正在嘗試對返回兩個值(稱為fstValue和lstValue)的表運行查詢。 我試圖讓我的查詢在fstValue> = 0和lstValue <= 100的情況下返回True,在所有其他情況下返回false。

有什么辦法可以在MySQL中做到這一點?

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

這個:

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'; 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM