select count(srd.SQuestion_Answer_ID) as qa_id,fi.File_description as title, s.Survey_ID as s_id,fi.Filename as image,u.F_name as first_name, u.L_name as last_name,ua.City as city,ua.State as state,s.Title as theme from Survey_Response_Definition srd,[User] u, Survey_Response sr,Survey_Question_Answer sqa,Survey_Answer sa,File_Info fi, User_Address ua,Survey_Source ss,Survey s where ua.State <> 'AZ' and fi.some_id not in (4370) and srd.SResponse_ID=sr.SResponse_ID and sr.Survey_ID=sqa.Survey_ID and srd.SQuestion_Answer_ID=sqa.SQuestion_Answer_ID and sqa.SAnswer_ID=sa.SAnswer_ID and sa.SAnswer_Text = cast(fi.FI_ID as varchar) and fi.Some_ID=u.UID and u.UID = ua.UID and sqa.Survey_ID=s.Survey_ID and s.SSource_ID=ss.SSource_ID and ss.Source_Name='PHOTO_CONTEST' group by srd.SQuestion_Answer_ID,fi.File_description,s.Survey_ID,fi.Filename,u.F_name, u.L_name,ua.City,ua.State,s.Title order by qa_id desc