You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

MySQL条件查询:筛选enable为true且min、max在2-30间的数据行

Alright, let's tackle this filtering problem. Here's how to get the exact result you're looking for:

First, let's lay out your original dataset clearly:

idenableminmax
1true410
2false523
3true645

Key Filtering Criteria

We need to apply two layers of checks:

  • First, ignore any rows where enable is false—these are excluded entirely.
  • For rows where enable is true, we only keep those where both min and max fall within the range of 2 to 30 (inclusive).

Applying the Filters to Each Row

Let's go through each entry to see which ones qualify:

  • Row 1: enable is true, min=4 (fits 2-30), max=10 (fits 2-30) → kept
  • Row 2: enable is false → excluded
  • Row 3: enable is true, but max=45 is outside the 2-30 range → excluded

Final Filtered Result

idenableminmax
1true410

If you're using a tool like SQL to automate this, here's a sample query that would give you the above result:

SELECT id, enable, min, max
FROM your_table
WHERE enable = true
  AND min BETWEEN 2 AND 30
  AND max BETWEEN 2 AND 30;

内容的提问来源于stack exchange,提问作者Amin Nazari

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:33:10