I'm sorry if i created duplicate post. I'm having problem to view data using db::select.
Here is my full sql statement [Tested and return value as expected on mysql]
SELECT tugasan_kontrak.*,sejarah.tkh_wujud AS tkh_wujud ,sejarah.id_tindakan AS id_tindakan
FROM tugasan_kontrak
LEFT JOIN sejarah ON(
tugasan_kontrak.id_tugasan = sejarah.id_tugasan AND
jenis_tugasan='k' AND
sejarah.id_tindakan !='99' AND
id_sejarah = (SELECT MAX(id_sejarah) FROM sejarah WHERE
tugasan_kontrak.id_tugasan = sejarah.id_tugasan AND jenis_tugasan='k')
)
WHERE pegawai_tugas='890911105098' AND id_tindakan IS NOT NULL
But when i try to apply this statement using db::select , no record were view.
Here function i use to test
public function getPenggunaTindakan($value='890911105098')
{
$kontrak = DB::select("select tugasan_kontrak.*,sejarah.tkh_wujud as tkh_wujud ,sejarah.id_tindakan as id_tindakan
from tugasan_kontrak left join sejarah on(tugasan_kontrak.id_tugasan = sejarah.id_tugasan and jenis_tugasan='k' and sejarah.id_tindakan !='99' and
id_sejarah = (select max(id_sejarah) from sejarah where tugasan_kontrak.id_tugasan = sejarah.id_tugasan and jenis_tugasan='k'))
where pegawai_tugas=:nokp and id_tindakan is not null ",['nokp' => $value]);
dd($kontrak);
}
Sorry for my bad english. Hope anyone can advice what i do wrong. thanks in advanced
via user3875285