SQL Server Performance

join probles

Discussion in 'SQL Server 2005 General Developer Questions' started by mpolaiah, Nov 12, 2008.

  1. mpolaiah New Member

    hai all,
    in sql satement quastionmaster and optionmaster there i pas the questionid , i want that particular quastion all optionid see the below quare like...
    select d.ndistrictid, d.sdistricttname, a.nassemblyid, a.sassemblytname, sa.nquestionid, qm.squestiontname, op.noptionid, op.soptionname,
    op.nsortorder, count(*) as total
    from td_survey_results sr--, td_survey_results_details srd, td_survey_answer sa, td_assembly a, td_district d, td_question_master qm, td_survey_option_master op
    inner join td_survey_results_details srd on sr.nresultid = srd.nresultid
    inner join td_survey_answer sa on sr.nresultid = sa.nresultid
    inner join td_assembly a on sr.nassemblyid = a.nassemblyid
    inner join td_district d on a.ndistrictid = d.ndistrictid
    inner join td_question_master qm on sa.nquestionid=qm.nquestionid
    inner join td_survey_option_master op on sa.sanswer = op.noptionid
    where
    qm.nquestionid=18
    and a.nassemblyid=120
    group by d.ndistrictid, d.sdistricttname, a.nassemblyid, a.sassemblytname, sa.nquestionid, qm.squestiontname, op.noptionid, op.soptionname,op.nsortorder
    order by a.nassemblyid

Share This Page