select class by excul id
unknown
pgsql
4 years ago
1.6 kB
11
Indexable
select
mc.class_id,
mc.class_name,
msl.abbreviation,
myl.description,
tslr.order_number
from ms_excul_mapping
join ms_excul me
on ms_excul_mapping.excul_id = me.excul_id
and me.deleted_at is null
join ms_excul_mixed_year_level memyl
on ms_excul_mapping.excul_mixed_id = memyl.excul_mixed_id
and memyl.deleted_at is null
join tr_school_level_relation tslr
on tslr.school_location_id = memyl.school_location_id
and tslr.school_level_id = memyl.school_level_id
and tslr.year_level_id = memyl.year_level_id
and tslr.deleted_at is null
join tr_academic_calendar tac
on tac.school_level_relation_id = tslr.school_level_relation_id
and tac.deleted_at is null
and tac.academic_year = me.academic_year
join ms_class mc
on mc.academic_calendar_id = tac.academic_calendar_id
and mc.deleted_at is null
join ms_school_level msl
on msl.school_level_id = tslr.school_level_id
and msl.deleted_at is null
join ms_year_level myl
on myl.year_level_id = tslr.school_level_relation_id
and myl.deleted_at is null
where ms_excul_mapping.excul_id = 3859
and ms_excul_mapping.deleted_at is null
and tac.period_id = (select max(period_id) from ms_period)
group by
msl.abbreviation,
myl.description,
tslr.order_number,
mc.class_idEditor is loading...