select eo.NameOfInstitution,s.SessionName,dt.CodeValue as Term,s.BeginDate,s.EndDate,s.TotalInstructionalDays ,dg.CodeValue as GradingPeriodCode,dg.ShortDescription as GradingPeriod,gp.BeginDate,gp.EndDate,gp.TotalInstructionalDays from edfi.Session s left join edfi.EducationOrganization eo on eo.EducationOrganizationId=s.SchoolId left join edfi.Descriptor dt on dt.DescriptorId=s.TermDescriptorId left join edfi.SessionGradingPeriod sgp on sgp.SessionName=s.SessionName and sgp.SchoolId=s.SchoolId and sgp.SchoolYear=s.SchoolYear left join edfi.GradingPeriod gp on gp.SchoolId=sgp.SchoolId and gp.SchoolYear=sgp.SchoolYear and gp.GradingPeriodDescriptorId=sgp.GradingPeriodDescriptorId left join edfi.Descriptor dg on dg.DescriptorId=gp.GradingPeriodDescriptorId order by eo.NameOfInstitution,s.BeginDate,s.EndDate desc,s.TermDescriptorId,gp.BeginDate,gp.TotalInstructionalDays