thinkphp+mysql+join+where_thinkphp5.0 多join时where无法between
情況類似于這個鏈接,這帖子的老哥沒有答案,現在遇到一樣的問題了,下面貼上代碼
$map = ['products.insurance_status'=>1];//是否計算下線的產品
if( input('get.times') && input('get.times') < 7 ){
$time = return_times(input('get.times'));
//此處有bug
$map['order.pay_time'] = ['between time', [strtotime($time['start']),strtotime($time['end'])]];
}
$list = db('xmb_insurance_products')
->alias('products')
->field('products.*,company.company_name,count(order.id) num,sum(order.order_amount) price')
->join('xmb_insurance_company company', 'products.insurance_company_id=company.id', 'left')
->join('xmb_insurance_order order', 'order.insurance_id=products.id and order.order_status=1','left')//此處購買數,如果給了and status=1,則購買數不計入未支付的訂單
->group('products.id')
->order('products.id desc')
->where($map)
->paginate(7,false,[ 'type'=> 'page\Page','var_page'=>'page','query' => $this->request->get()]);
結果:
求助:以下語句應該如何處理好
$map['order.pay_time'] = ['between time', [strtotime($time['start']),strtotime($time['end'])]];
問題描述
問題出現的環境背景及自己嘗試過哪些方法
相關代碼
// 請把代碼文本粘貼到下方(請勿用圖片代替代碼)
你期待的結果是什么?實際看到的錯誤信息又是什么?
總結
以上是生活随笔為你收集整理的thinkphp+mysql+join+where_thinkphp5.0 多join时where无法between的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: docker 多个mysql_mysql
- 下一篇: windows下统一mysql编码_my