x27;
http://dev.mysql.com/doc/mysql/en/UPDATE.html
Regards,
Lachlan
-Original Message-
From: prolist [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 10 August 2004 3:52 PM
To: [EMAIL PROTECTED]
Subject: Update with subquery problem
I am trying to update a related table with a subquery. This is
Subqueries are not supported until mysql 4.1. I'm guessing you have an
earlier version. With version 4.0.4 or later, you can accomplish the same
thing with a multi-table update:
UPDATE tbl1, tbl2 SET tbl1.col1 = tbl1.col1 + 1
WHERE tbl1.ID = tbl2.ID AND tbl2.status='Active';
or equivalentl
I am trying to update a related table with a subquery. This is what I am
using -
update tbl1 set col1=col1+1 where ID IN (select ID from tbl2 where
status='Active');
But I get syntax error. I am not much of a database guy, so can't understand
what am I doing incorrectly. Can someone help?
TIA,
-