我有兩個日期格式,一個是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