我想在yii2模型搜索()
中恭维mysql查询SELECT * FROM `parking_availability` WHERE ('09:00' BETWEEN `time_start` AND `time_end` ) AND
( '11:00' BETWEEN `time_start` AND `time_end` )
我已经像这样申请了
$query->andFilterWhere([$this->arrivaltime,'between','time_star', 'time_end'])
->andFilterWhere([$this->departuretime,'between','time_star', 'time_end']);
但显示错误运营商' 00'需要两个操作数。
请帮助我,谢谢
答案 0 :(得分:2)
您尝试的方向正确,但是您的参数输入顺序错误。第一个必须是'between'
运算符:
$query->andFilterWhere(['between', $this->arrivaltime, 'time_start', 'time_end'])
->andFilterWhere(['between', $this->departuretime, 'time_start', 'time_end']);