EasyCFM.COM ColdFusion Forums / MySQL Related Issues / Syntax error trying to do two updates at same time

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: Syntax error trying to do two updates at same time

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

riogrande
02-27-2008 @ 10:45 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 509
Joined: Mar 2003

I get an error with this:
UPDATE  
`clientinfo` SET `countryid`='it' WHERE (`country`='italia')
and
UPDATE  
`clientinfo` SET `countryid`='it' WHERE (`country`='italy')

but on their own they work-where is my basic error here? Thanks

dlackey
02-27-2008 @ 2:09 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Moderator
Posts: 935
Joined: Jun 2007

are the two updates within the same <cfquery> </cfquery> block?

<cfquery>
update A
and
update B
</cfquery>

or is it like
<cfquery>
update A
</cfquery>
<cfquery>
update B
</cfquery>
Cheers,
Chip

This message was edited by dlackey on 2-27-08 @ 2:09 PM

Lossed
02-27-2008 @ 3:55 PM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 1095
Joined: Apr 2004

in()

Lossed
---------------------------
When the only tool you have is a hammer, everything looks like a nail Smile
-----------------------------

riogrande
02-28-2008 @ 9:05 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Senior Member
Posts: 509
Joined: Mar 2003

Apologies I didnĀ“t say that I am using this directly in my mysql gui to try and update data in a table. I am saving my (pure sql) query (to use on another db)and although it works fine doing a country like so:
UPDATE  
`clientinfo` SET `countryid`='it' WHERE (`country`='italia')

then having a new query to do another

UPDATE  
`clientinfo` SET `countryid`='gb' WHERE (`country`='united kingdom')

I just want to do all at once hence the question. Thanks



This message was edited by riogrande on 2-29-08 @ 11:02 AM


Website Designed and Developed by Pablo Varando.