我有Tbl_payroll_leave_employeev2
和tbl_payroll_leave_schedulev2
两个表,我想join
他们但是我得到这样的错误
SQLSTATE [23000]:完整性约束违规:1052列' payroll_leave_employee_id' where子句不明确(SQL:从
payroll_employee_id
tbl_payroll_leave_employee_v2
tbl_payroll_leave_schedulev2
tbl_payroll_leave_employee_v2
payroll_leave_employee_id
tbl_payroll_leave_schedulev2
payroll_leave_employee_id
payroll_leave_employee_id
$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();
window.setTimeout()
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <h1>Green Planet</h1> <p id="greenplanet">All is well</p> <h1>Red Planet</h1> <p >Nothing to report</p> <h1 >Blue Planet</h1> <p >All systems A-OK</p> <script> function init() { window.setTimeout(function() { var planet = document.getElementById("greenplanet"); planet.innerText = "Red Alert: hit by phaser fire!"; planet.setAttribute("class","redtext"); alert("it initialized"); }, 1000); } window.onload=init; </script> </body> </html>
}N
= 5)◀
N
答案 0 :(得分:2)
在where条件中,您必须定义表格payroll_leave_employee_id
或表格tbl_payroll_leave_employee_v2
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();