dbTalk Databases Forums  

Informix 9: Update with FROM

comp.databases.informix comp.databases.informix


Discuss Informix 9: Update with FROM in the comp.databases.informix forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
M. Weber
 
Posts: n/a

Default Informix 9: Update with FROM - 06-07-2010 , 08:14 AM






Hi Guys,

sorry for my english but i'll try to explain my problem.

I want to update an table called user. But i have to connect in the
WHERE-condition two tables over an index. Therefore my statement looks like:

UPDATE user
SET user.onl_login = (SELECT email.email FROM email WHERE
email.artkz='RZ' AND email.identnr = 4517)
FROM user, identroll
WHERE user.identnr = 4517 AND user.identroll = identroll.identnr AND
identroll.rolle ='S';

When i want to update the value, an error occurs. The FROM-tag seems to
be unknown in the UPDATE-statement. But when i look at the official
documentation of informix, then the usage of FROM seems to be okay.

Could somebody solve my problem?

Thx in advance.

Michael

Reply With Quote
  #2  
Old   
M. Weber
 
Posts: n/a

Default Re: Informix 9: Update with FROM - 06-07-2010 , 08:48 AM






Hello guys,

i found a solution. I have to use the IN-Operator and therefore the
SQL-Statement looks like:

UPDATE user
SET user.onl_login = (
SELECT email.email FROM email WHERE email.artkz='RZ' AND email.identnr =
user.identnr
)
WHERE user.identnr IN (
SELECT identnr
FROM identroll
WHERE identroll.rolle ='S' AND identroll.identnr=user.identnr
);

Now, everything is fine. Thx a lot.

Greets.

Michael

Reply With Quote
  #3  
Old   
Art Kagel
 
Posts: n/a

Default Re: Informix 9: Update with FROM - 06-07-2010 , 10:04 AM



UPDATE user
SET user.onl_login = (SELECT email.email FROM email WHERE
email.artkz='RZ' AND email.identnr = 4517)
WHERE rowid in (
SELECT user.rowid
FROM user as user2, identroll
WHERE user2.identnr = 4517
AND user2.identroll = identroll.identnr
AND identroll.rolle ='S'
);
Art S. Kagel
Advanced DataTools (www.advancedatatools.com)
IIUG Board of Directors (art (AT) iiug (DOT) org)

Disclaimer: Please keep in mind that my own opinions are my own opinions and
do not reflect on my employer, Advanced DataTools, the IIUG, nor any other
organization with which I am associated either explicitly, implicitly, or by
inference. Neither do those opinions reflect those of other individuals
affiliated with any entity with which I am affiliated nor those of the
entities themselves.



On Mon, Jun 7, 2010 at 9:14 AM, M. Weber <michael.weber (AT) fh-stralsund (DOT) de>wrote:

Quote:
Hi Guys,

sorry for my english but i'll try to explain my problem.

I want to update an table called user. But i have to connect in the
WHERE-condition two tables over an index. Therefore my statement looks
like:

UPDATE user
SET user.onl_login = (SELECT email.email FROM email WHERE
email.artkz='RZ' AND email.identnr = 4517)
FROM user, identroll
WHERE user.identnr = 4517 AND user.identroll = identroll.identnr AND
identroll.rolle ='S';

When i want to update the value, an error occurs. The FROM-tag seems to
be unknown in the UPDATE-statement. But when i look at the official
documentation of informix, then the usage of FROM seems to be okay.

Could somebody solve my problem?

Thx in advance.

Michael
_______________________________________________
Informix-list mailing list
Informix-list (AT) iiug (DOT) org
http://www.iiug.org/mailman/listinfo/informix-list

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.