简体   繁体   中英

MySQL equal to X and greater than Y

Having ones of those moments..

Basically all I want to do is say

SELECT * FROM gg_Crates WHERE minutes...

equal -1 AND also bring back result for where minutes is greater than or equal to X

X is a variable so the results will always bring back the -1 as well as anything greater than X

How about this:

SELECT * FROM gg_Crates 
  WHERE minutes = -1 
     OR minutes >= X

You can also try this query,

SELECT * FROM gg_Crates WHERE minutes = -1 
UNION
SELECT * FROM gg_Crates WHERE minutes >= X

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM