Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有这张表(MySQL):
|id|min|max|info| +--+---+---+----+ |1 |18 |24 | ...| +--+---+---+----+ |2 |22 |26 | ...|
SQL:
SELECT * FROM myTable WHERE max <= 21 AND min >= 21
结果:
NULL
解决方案:
SELECT * FROM myTable WHERE 21 <= max AND 21 >= min
没有带 的行max <= 21。两行都max大于 21!
max <= 21
max