MySQL Forums
Forum List  »  Microsoft SQL Server

Update From Syntax
Posted by: Harry Leboeuf
Date: September 27, 2010 11:52AM

Hello,

This is a syntax we where using on a sql-server, or the syntax how we would write it. As our company Joomla intranet works on MySql i'm not familar with the syntax here ... What should i change, i've tried different version and each time running into a error.

update jos_scouts_rsform_submission_values set sv.fieldvalue =
((select sum(case when sv2.fieldvalue = 1 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*19 )+
((select sum(case when sv2.fieldvalue = 2 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*13 )+
((select sum(case when sv2.fieldvalue = 3 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*11 )+
((select sum(case when sv2.fieldvalue = 4 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*8 )+
((select sum(case when sv2.fieldvalue = 5 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*10 )+
((select sum(case when sv2.fieldvalue = 6 then 1 else 0 end) from jos_scouts_rsform_submission_values sv2 where sv2.submissionid = sv.submissionid and sv2.fieldname like 'menu%')*7 )
from jos_scouts_rsform_submission_values sv
where sv.formid = 5
and sv.fieldname = 'result'

I know its a strange query but this is how our component stores its info.

Kind regards, Harry

Options: ReplyQuote


Subject
Written By
Posted
Update From Syntax
September 27, 2010 11:52AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.