我有tbl_batch哪个
id
title
start_date
start_time
end_time
venue_id
created_by
在数据库中 start_time 和 end_time 被保存为time()
排:-
id 1
title test
start_time 10:10
end_time 11:30
venue_id 1
start_date 2020-03-01 (Y-m-d)
created_by 1
所以我想检查时间是否在给定start_time的.end_timestart_date
我试过的查询:-
$model = Batch::find()->where([
'start_date' => '2020-03-01',
'venue_id' => 1
])->andWhere([
'AND',
[ '>=',
'start_time',
'10:20'
],
[ '<=',
'end_time',
'19:20'
]
]);
if($model->exists()){
echo 'Already exists in DB';
}else
{
echo 'Does not Exist';
}
这没有返回正确的输出。
达令说