MySQL Forums
Forum List  »  Newbie

Problem with update with select
Posted by: Joe Bob
Date: June 29, 2006 11:43AM

I am using MySQL 5.0.16 and am having a problem running an update statement. I'd appreciate any advice you may have.

Here's the statement:

UPDATE ent_acct_inst
SET cust_id = (
SELECT c.id
FROM ent_user u, ent_customer c, ent_acct a
WHERE c.admin_guid = u.id
AND a.cust_id = c.id
AND a.id = ent_acct_inst.acct_id)

When I run it the query parses fine, but I get no rows updated. I know the data in those tables is good so an update should be happening.

Another similar statement is updating just fine:

update ent_acct_rule
set created_by_user_name = (
select display_name
from ent_user u, ent_customer c, ent_acct a
where c.admin_id = u.id
and a.cust_id = c.id
and a.id = ent_acct_rule.ent_acct_id)

I'm stumped as to why one statement would work and not the other. I know it may be hard to diagnose without the tables and data, but any clues?

Options: ReplyQuote


Subject
Written By
Posted
Problem with update with select
June 29, 2006 11:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.