Hi there -
I have two tables, of which table 1 records who have opened an application and table 2 records their answers.
table 1:
Std_id, Name, Status
table 2:
Std_id, Q_id, Answers
where q_id is question id.
Table 1 has one record for each student who has answered questions/just opened an application and table 2 has multiple rows for each student. The table 2 has answers given by each student for 10 questions.
I want to extract the students who have opened the application and also want the answer for question number 5.
I was using the following query,
this query returns multiple rows and I understand why.As there is an inner join and table 2 has different answers and q_id, so the join picks up every row from table 2. How can I avoid this,also the NVL on select does not work. It picks up all the answers. I want to pick only answer for q_id 5.
can some one please guide me on how can I achieve just one row per student entry. thank you.
I have two tables, of which table 1 records who have opened an application and table 2 records their answers.
table 1:
Std_id, Name, Status
table 2:
Std_id, Q_id, Answers
where q_id is question id.
Table 1 has one record for each student who has answered questions/just opened an application and table 2 has multiple rows for each student. The table 2 has answers given by each student for 10 questions.
I want to extract the students who have opened the application and also want the answer for question number 5.
I was using the following query,
Code:
Select app.Std_id,Name as ApplicantName, Status , NVL((select TRIM (DBMS_LOB.SUBSTR (ans.Answers, 20, 1)) from tabl2 where Q_ID = 5 ), 'N.A') AS School from tabl1 app inner join tabl2 ans on APP.Std_id = ANS.Std_id WHERE Status in ('I','C')
can some one please guide me on how can I achieve just one row per student entry. thank you.
Comment