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