php|php laravel db leftjoin 一个数据集的写法
【php|php laravel db leftjoin 一个数据集的写法】$_query = DB::table(‘a as o’)
->leftJoin(DB::raw("(select id,count( user_id ) AS click,
count( DISTINCT user_uid ) AS only_click from`aa`
where`click_dt` >= '$start_date'
AND `click_dt` <= '$end_date'
GROUP BY source_id ) as cli"),'aa.source_id','=','o.itemId')->where('o.Time','>=',$start_date.' 00:00:00')
->where('o.Time','<=',$end_date.' 23:59:59')
->where('o.status','!=',13);
推荐阅读
- thinkphp|thinkphp 3.2 如何调用第三方类库
- CGI,FastCGI,PHP-CGI与PHP-FPM
- PHP开发-Mac搭建ThinkPHP5.0
- laravel框架泛解
- 依赖注入模块
- thinkphp3.2下实现阿里云视频点播实例(客户端JavaScript上传)
- php异常处理
- mac|mac php5.6+mongdb+Apache环境配置
- PHP简易规则引擎
- PHP|PHP 扩展开发检测清单(扩展开发必读)