Skip site navigation (1) Skip section navigation (2)

Table Alias posing problem in Update statements

From: Pushker Chaubey <pchaubey(at)vertex(dot)co(dot)in>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Table Alias posing problem in Update statements
Date: 2008-09-01 15:01:05
Message-ID: 48BC03B1.6020500@vertex.co.in (view raw or flat)
Thread:
Lists: pgsql-jdbc

Hi experts,

I am facing a problem using a Alias on a table while updating that table.

I am trying something like

UPDATE Table1 T1 SET  = (SELECT DISTINCT col2 FROM Table2 T2 WHERE 
T2.col3 = T1.col1)

T1 and T2 are table aliases.

Here I am trying to update a column in all the rows in table "Table1" 
depending on value of another column for the same row.
But the query is not working. It is not allowing alias in the update 
query (i.e. alias T1 on table "Table1").

Am I making a mistake somewhere in the syntax? Or, is it just not 
supported in postgresql?
I am using postgreSQL version 8.2.

I have observed similar problems with delete statements also.
But these types of queries run successfully on Oracle.

Thanks in advance.
Pushker Chaubey


The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy the original message all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.

Please do not print this email unless it is absolutely necessary.

Responses

pgsql-jdbc by date

Next:From: Richard BroersmaDate: 2008-09-01 17:11:03
Subject: UPDATE ... CURRENT OF cursorname
Previous:From: Devrim GÜNDÜZDate: 2008-08-30 13:30:12
Subject: Need a developer contact

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group