sql - Optimising a query -
I have searched the web in an attempt to eliminate this problem, but there is no luck, this is my first SQL question : -)
I am a simple man with simple questions - Allow me to display
select asy.aim_student_id, from aim_student_test to aim_test at ast ( Asa.aps_yr = ast.aps_yr and asa.aim_test = ast.aim_test and asa.aim_id = ast.aim_id) --join target_student_qst at ASQ (asq.aps_yr = ast.aps_yr and ASQ aim_student_absent join ASA. Target_test = ast. Aim_test and asq.aim_id = ast.aim_id) at aim_student_yr asy m Joining (asy.aps_yr = ast.aps_yr and asy.aim_student_yr_id = ast.aim_student_yr_id) where ast.aps_yr = '2012' As you can see - join aim_student_qst Have commented.
aim_student_qst is a table that lists responses to a student for all questions, then a student will have ~ 50 cases in this table. To check that my query was slowing down, I only commented on joining aim_student_qst and I am sure that my query has been corrected
I think what Oracle is doing is happening - Oh, you want those tables, put them on a big table and then see what we want. This is the reason that despite doing nothing with the purpose, my query is slow I_student_qst Is this correct?
For my purposes I only have to choose a question for each student, for example instead of all 50. Is there any way to do this?
thanks !!!!!
Maybe that's it?
select asy.aim_student_id, ast.aim_test from aim_student_test at ast (asa.aps_yr = ast.aps_yr and asa.aim_test = ast.aim_test and asa.aim_id = aim_student_absent joining ASA Ast.aim_id) joining aim_student_qst ASQ (asq.aps_yr = ast.aps_yr and asq.aim_test = ast.aim_test and asq.aim_id = ast.aim_id) to join aim_student_yr asy (asy.aps_yr = ast. Aps_yr and asy.aim_student_yr_id = ast.aim_student_yr_id) where ast.aps_yr = '2012' and asq.question_number = 1 - got the column name and asq.question_answer is empty - assumed the column name and value;
Comments
Post a Comment