SQLSTATE[42703]: Undefined column: 7 ERROR: column v_patient.employeeid does not exist LINE 16: ... LEFT JOIN v_emp v_patient ON v_patie... ^ HINT: Perhaps you meant to reference the column "v_patient.employeeID" or the column "v_patient.employeeCC". (SQL: SELECT sp .*,…
I'm getting error where few query is not capitalize when the actual column name should be capitalize, so I try to follow where someone said it should be putting in identifier double quote just like this "**"
or backticks ``. Both doesn't work and still producing error, is that alternative for identifier double quote in laravel in order to put column that have capital letter on it?
$sql = "SELECT
sp.*,
patient.v_emp_id as badge_number, v_patient.positionTitle as jabatan, v_patient.dpName as tempat_kerja,
`v_spv.employeeName` as name_spv, v_spv.phones as telp_spv, `v_patient.todayShiftDesc` as today_shift, `v_patient.tomorrowShiftDesc` as tom_shift,
(CASE WHEN rp.ifirm_id IS NOT NULL THEN ifirm.ifirm_name ELSE 'UMUM' END) AS penanggung,
loc.locid
FROM surat sp
LEFT JOIN reg rp ON rp.regpid = sp.regpid
LEFT JOIN person patient ON patient.pid = sp.pid
LEFT JOIN v_emp v_patient ON `v_patient.employeeID` = patient.v_emp_id
LEFT JOIN v_emp v_spv ON `v_patient.sprEmployeeID` = `v_spv.employeeID`
LEFT JOIN person doctor ON doctor.pid = sp.doctor_id
LEFT JOIN insurance_firm ifirm ON rp.ifirm_id = ifirm.ifirm_id
LEFT JOIN laboratory_order_chem loc ON loc.regpid = rp.regpid
WHERE
sp.spid = {$spid}";
return DB::selectOne($sql);