strategy for SQL headers and detail report

KenWillll

New Member
I want to get all schools from the mysql school table and get all students of each school in the students table. for a web based report with heading and totals. I could do something likeselect * from schools join students on schoolNo = schoolNo order by schoolNoHowwever this way I think I will have to keep track of current schoolNo and compare with previous schoolNo in order to generate a header and student count totals for each new school.Alternatively I could do a Select on Schools and additional selects on students for each school found. This is more intuitive but looks very inefficient.Does mySQL offer a better techniques fot this like specialized reporting tools like Crystal reports.thanks
 
Back
Top