Unix Technical Forum

update with join

This is a discussion on update with join within the MySQL forums, part of the Database Server Software category; --> On Wed, 05 Dec 2007 12:55:37 +0100, Michele <nomail@nomail.it> wrote: > Where is the error in this update with ...


Go Back   Unix Technical Forum > Database Server Software > MySQL

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #11 (permalink)  
Old 02-28-2008, 10:30 AM
Rik Wasmus
 
Posts: n/a
Default Re: update with join

On Wed, 05 Dec 2007 12:55:37 +0100, Michele <nomail@nomail.it> wrote:

> Where is the error in this update with join
>
> update snx_comuni set sta_id = 2782
> from snx_comuni


Euhm, no FROM, you don't update FROM.

> inner join snx_province on snx_comuni.provincia_id =
> snx_province.provincia_id
> inner join snx_regioni on snx_province.regione_id =
> snx_regioni.regione_id
> where snx_regioni.codice_regione = 'PIE'


Try this, and if it doesn't work, tell us what MySQL sais the error is:
update snx_comuni
inner join snx_province on snx_comuni.provincia_id =
snx_province.provincia_id
inner join snx_regioni on snx_province.regione_id =
snx_regioni.regione_id
set snx_comuni.sta_id = 2782
where snx_regioni.codice_regione = 'PIE'
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 02-28-2008, 10:30 AM
Captain Paralytic
 
Posts: n/a
Default Re: update with join

On 5 Dec, 11:55, Michele <nom...@nomail.it> wrote:
> Where is the error in this update with join
>
> update snx_comuni set sta_id = 2782
> from snx_comuni
> inner join snx_province on snx_comuni.provincia_id =
> snx_province.provincia_id
> inner join snx_regioni on snx_province.regione_id = snx_regioni.regione_id
> where snx_regioni.codice_regione = 'PIE'


MySQL will have told you. Even if you didn't understand it, telling us
what MuSQL told you would seem sensible, don't you think!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 02-28-2008, 10:30 AM
Michele
 
Posts: n/a
Default Re: update with join

now it is OK...

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:05 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com