我尝试通过使用以下查询加入3个表来检索数据,但是它返回上述错误(标题中)。我找不到问题所在。预先谢谢你。
$data = DB::connection('pgsql_backoffice')
->table('tusers')
->join('tservices','tusers.user_id','=','tservices.user_id')
->join('tnotify_send_info','tnotify_send_info.user_id','=','tnotify_send_info.user_id')
->select('tusers.user_id','tservices.account_no','tusers.cust_type','tusers.first_name','tusers.last_name','tusers.company_name','tservices.created_t','tservices.start_t','tnotify_send_info.notify_actual_date')
->where('tservices.plan_id','tnotify_send_info.package_id')
->get();
错误表明'tnotify_send_info.package_id'出了些问题
答案 0 :(得分:0)
使用whereColumn()
比较列:
->whereColumn('tservices.plan_id', 'tnotify_send_info.package_id')