本文介绍了违反完整性约束:1052列和where子句不明确的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个表 Tbl_payroll_leave_employeev2
和 tbl_payroll_leave_schedulev2
,我想加入
他们,但是我收到这样的错误
I have two table the Tbl_payroll_leave_employeev2
and tbl_payroll_leave_schedulev2
and i want to join
them but im getting an error like this
我的表结构
My table structure
$employee_id = Tbl_payroll_leave_employeev2::select('payroll_employee_id')
->join('tbl_payroll_leave_schedulev2','tbl_payroll_leave_employee_v2.payroll_leave_employee_id','=','tbl_payroll_leave_schedulev2.payroll_leave_employee_id')
->where('payroll_leave_employee_id',$emp)
->get();
推荐答案
在这种情况下,必须定义字段<$表 tbl_payroll_leave_employee_v2
或表 tbl_payroll_leave_schedulev2
In where condition, you must define the field payroll_leave_employee_id
of table tbl_payroll_leave_employee_v2
or table tbl_payroll_leave_schedulev2
$employee_id = Tbl_payroll_leave_employeev2::select('payroll_employee_id')
->join('tbl_payroll_leave_schedulev2','tbl_payroll_leave_employee_v2.payroll_leave_employee_id','=','tbl_payroll_leave_schedulev2.payroll_leave_employee_id')
->where('tbl_payroll_leave_schedulev2.payroll_leave_employee_id',$emp)
->get();
这篇关于违反完整性约束:1052列和where子句不明确的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!