我怎樣才能做到在過濾日期範圍BETWEEN和或選擇
Select * from XXX where date between DATE1 AND DATE2 OR Between DATE3 AND DATE4
(從更新張貼的答案複製)
這裏是我的病情
WHERE (items_count != '0')
AND (main_table.is_active = '1')
AND (main_table.store_id IN ('0', '1'))
AND (main_table.updated_at BETWEEN
'2011-03-04 16:52:19' AND '2011-03-05 16:52:19'
)
OR (main_table.updated_at BETWEEN
'2011-03-13 16:52:19' AND '2011-03-14 16:52:19'
)
LIMIT 0, 30
第一個條件永不使用
您需要在基或AND((第一狀態)OR(第二狀態)) – BlackTigerX 2011-03-15 17:15:14