I have a joined table from siswa and kelas. in kelas table there is a column idSiswa, it comes from id from siswa table. the question is how I can get the id from kelas when its joined. when I try to fetch id it shows the id from siswa table, not from kelas table, I also already used right join and left join and still not get the answer
I using a query builder from laravel to run the query, and this is my query
$siswa = DB::table('siswas')
->join('kelas', 'kelas.idSiswa', '=', 'siswas.id')
->where([
['kelas.kelas', '2'],
['kelas.semester', 'ganjil'],
])
->select('kelas.*', 'siswas.*')
->get();