My Db table is as follows
|id|code|qn1|qn2|qn3|qn4|qn5|.............|qn38|qn39|qn40|name|modfiedDate|status|RollNo|
i am trying to optimize the query to fetch details from this table
i need to find the number of unanswerd question and option selected for the question i view currently
ex : qn1 hold value selected for question 1
Query
select * from tbl_name where code ='xx' and RollNo ='123';
view page display's one question at a time and i would need the total unanswered questions and has lots of hits
there are totally 40 fields for question sometime there may be only 22 question
so Does this query improve performance
$field_str="";
for($no=1;$no<=$TotalQ_count;$no++)
{   
    $field_str .= ",qn".$no;
}
$field_str =ltrim($field_str,",");
$querycnt = "SELECT status, $field_str from tbl_name
 where code ='xx' and RollNo ='123' ";
is there any other way to improve this query?
