alter procedure getac
select a1.*,b.photo from (select iname,Course, Semester,UID,upper(sname) as sname, upper(fname) as fname,UPPER( mname) as mname, uppeR(subjectcode) as subjectcode,UPPER( subjectname) as subjectname,
ems as 'Detained Status'
group by iname,Course,semester,UID,sname,fname,mname,subjectcode,subjectname,ems
)as a1,custudents b
and a1.course='BE-ME(App.Sc.)' and a1.semester=1
AND b.fflag=1 AND b.eflag=1 and b.lflag=0 and b.FLAG=1
and b.photo is not null
order by a1.iname,a1.course,a1.semester,a1.uid,a1.subjectcode
This is the procedure, can we more optimize for faster output.
Secondly what are the fields to be indexed.