If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > update in mysql

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-04-04, 09:20
sandeep_ram sandeep_ram is offline
Registered User
 
Join Date: Apr 2004
Posts: 2
Talking update in mysql

friends..

i have an error using update in my sql

my query is..


update table1 set table1.par1=table2.par1
where table1.id=table2.id

i got the error that table2 is not defined

but table1 and table2 are in the same database

i am using mysql 3.9 version

can u help?
Reply With Quote
  #2 (permalink)  
Old 04-04-04, 09:31
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
the syntax you want is
PHP Code:
update table1
     
table2
   set table1
.par1 table2.par1
 where table1
.id table2.id 
unfortunately, you must be on 4.0 to use it

in 3.9 i think your only choice is to do a query, get the table2.par1 value, and use that in a simple update of table1
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On