I have the following table
I need to return only the last record of the teaching step sorted by year_level, using Laravel / MySql
Example: 2002 - 15 / 2004 - 16
I'm trying:
$carga_horaria = DB::select(DB::raw('ch.*'))
->from(DB::raw('(SELECT * FROM estudantes_carga_horaria ORDER BY ano_letivo DESC) ch'))
->groupBy('ch.etapa_ensino_id')
->get();