MySQL选择"在"之间和" AND"

时间:2017-03-01 10:22:43

标签: mysql sql between

我有一部分sql选择:

where `zipCode` between "40000" and "42000"
OR `zipCode` between "50000" and "51000"
OR `zipCode` between "53000" and "60000"
AND plan = "sell" 
AND created_at > '2017-01-01' 
AND clone_id is not null

我正在获得正确的zipCode范围。但条件是"计划" " ceated_at"和" clone_id"没有用。

2 个答案:

答案 0 :(得分:7)

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>

<div class="container">
  <div class="row">
    <div class="box col-sm-6 col-md-4" id="col4_1">Box 1</div>
    <div class="col-sm-6 col-md-8">
      <div class="row">
        <div class="box col-sm-12 col-md-4" id="col4_2">Box 2</div>
        <div class="box box3 col-sm-12 col-md-4" id="col4_3">Box 3</div>
        <div class="box box4 col-sm-12 col-md-4" id="col4_4">Box 4</div>
      </div>
    </div>
  </div>
</div>

答案 1 :(得分:0)

尝试一下对我有用:

delete from table_name where column_name between '2018-06-01 09:00:00' and '2018-10-01 18:00:00';