我有两个日期格式,一个是2013-01-01到2013-01-10,我有时间两次一个是20:00:00至23:59:59和00:00:00至07:00: 00,我使用的for循环迭代开始日期,结束日期,我希望下面的如何在php中给两个不同的日期到相同的查询?
查询:
select * from user where login >='$starttime' and logout <='$endtime' and date='$StartDate';
期待结果:
select * from user where login >='20:00:00' and logout <='23:59:59' and date='2013-01-01';
select * from user where login >='00:00:00' and logout <='07:00:00' and date='2013-01-02';
如果条件得到如何使用预期结果
听说过'或'的? –
首先从查询中删除one where子句。两个where子句会给出错误。 –
请分享您正在使用的代码来生成两个提到的查询 – Vishal