Thinkphp 逻辑与,逻辑或的复合查询
生活随笔
收集整理的這篇文章主要介紹了
Thinkphp 逻辑与,逻辑或的复合查询
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
查詢數據庫時,有時會遇到即使用了“邏輯與”也是用了“邏輯或”的查詢條件。
他的SQL語句如下:
在Thinkphp 中,實現這樣的查詢的方法如下
$personModel = D('person'); $where['firstName'] = array('eq','Thomas'); $where['firstName'] array('eq','William'); $where['_logic'] = "or"; $whereAll['_complex'] = $where; $whereAll['lastname'] = "Carter";$persons = $personModel->where($whereAll)->select();總結
以上是生活随笔為你收集整理的Thinkphp 逻辑与,逻辑或的复合查询的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Thinkphp 打印最近执行的一条SQ
- 下一篇: jQuery ajax发送POST、JS