select distinct state_id,state_abbrv,state_name from state where state_abbrv <>'AZ'
select s.Survey_ID as theme_id,s.Title as theme_name,
s.Start_Date as start_votingdate,s.End_Date as end_votingdate,
s.Description as description,ss.Start_Build as start_themedate,
ss.End_Build as end_themedate from Survey s, Survey_Source ss
where s.SSource_ID=ss.SSource_ID and ss.Source_Name='PHOTO_CONTEST'
select sqa.SQuestion_Answer_ID as image_id,fi.Path as image_path,fi.Filename
as image_name,fi.File_Description as title from
File_Info fi,Survey_Answer sa,Survey_Question_Answer sqa
where cast(fi.FI_ID as varchar)=sa.SAnswer_Text and
sa.SAnswer_ID=SQA.SAnswer_ID and sqa.Survey_ID=#themeid_tovote# and
not fi.File_Code_ID=0;
select SQuestion_Answer_ID from Survey_Question_Answer where
Survey_ID = #themeid_toupload# and
SQuestion_ID in (select SQuestion_ID from Survey_Question
where SQuestion_Text = '#themename_toupload#') and
SAnswer_ID in (select SAnswer_ID from Survey_Answer sa,File_Info fi where
sa.SAnswer_Text = cast(fi.FI_ID as varchar) and fi.Some_ID = '#cookie.user_id#')
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' and s.Survey_ID in
(#winner_week1_id#,#winner_week2_id#,#winner_week3_id#,#winner_week4_id#) 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
if (structKeyExists(photo_contest,"welcome_text")) {
welcome_text= photo_contest['welcome_text'];
}
if (structKeyExists(photo_contest,"welcome_text2")) {
welcome_text2= photo_contest['welcome_text2'];
}
if (structKeyExists(photo_contest,"terms_conditions")) {
terms_conditions= photo_contest['terms_conditions'];
}
if (structKeyExists(photo_contest,"photo_tip")) {
photo_tip= photo_contest['photo_tip'];
}
if (structKeyExists(photo_contest,"faq")) {
faq= photo_contest['faq'];
}
if (structKeyExists(photo_contest,"specs")) {
specs= photo_contest['specs'];
}
if (structKeyExists(photo_contest,"voting_rules")) {
voting= photo_contest['voting_rules'];
}
select Disclaimer_ID as D_ID from Disclaimer where
Some_ID=#themeid_toupload#
insert into User_Disclaimer (UID,Disclaimer_ID)
values (#cookie.user_id#,#D_ID#)