Manish,
What version of MySQL are you using?

The chances are subqueries are not supported in your version.

Try restructuring your query as a join like:

UPDATE
        tbl1,
        tbl2
SET
        tbl1.col1=tbl1.col1+1
WHERE
        tbl.ID = tbl2.ID
        AND tbl2.status='Active'

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 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,
- Manish


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]




-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to