Please kindly provide a SQL query for the figure in % of the number of students who start in F1 and stay on to finish F6 in the past two years. Thanks a lot.
Pls try the below SQL. select (select count(*) from VW_STU_LATESTSTUDENT a where a.SCHYEAR=x.schyear and a.classlvl='S6' and stuid in ( select distinct b.stuid from VW_STU_LATESTSTUDENT b where b.classlvl='S1' )) 'F6_START_FROM_F1', (select count(*) from VW_STU_LATESTSTUDENT a where a.SCHYEAR=x.schyear and a.classlvl='S6' ) 'F6_TOTAL', (F6_START_FROM_F1*100) / F6_TOTAL '%' from (select distinct schyear from TB_SCH_CALFORMAT) x where x.schyear=?