條件:查詢今天內郵箱和QQ其中一項都不為空的有效數據的查詢
釋義:(or 條件)email 不為空 或者 qq_no 不為空
(and 條件) is_deleted 為0 並且 create_time 為今天內
假設表格為 m_tab
$where = array('is_deleted'=>0,'create_time'=>array('gt',$time));//數據庫中時間字段未時間戳格式:$time 提前處理好為今天內時間
$count = $m_tab->where(array('email|qq_no'=>array('neq',''),'_complex'=>$where))->count();// 單 | 表示或
打印sql:
SELECT COUNT(*) AS tp_count FROM `m_tab` WHERE ( (`email` <> '') OR (`qq_no` <> '') ) AND ( ( `is_deleted` = 0 ) AND ( (`create_time` <= 1483545599) AND (`create_time` >= 1483459200) ) ) LIMIT 1