Re: [GENERAL] Why UPDATE gl SET gl.glnum = gl.glnum; cause error when UPDATE gl

2005-07-08 Thread Douglas McNaught
David Gagnon <[EMAIL PROTECTED]> writes: > update test set id=test2.id from test2 where id=test2.id; > > ERROR: column reference "id" is ambiguous It's complaining about the second use of "id", which could mean either "test2.id" (which would be a self-join) or "test.id" (which is what you want).

Re: [GENERAL] Why UPDATE gl SET gl.glnum = gl.glnum; cause error when UPDATE gl

2005-07-08 Thread David Gagnon
I have a construct where column has the same name .. and when I use the FROM clause  I get the following error: create table test (     id varchar(8) ); create table test2 (     id varchar(8) ); update test set id=test2.id from test2 where id=test2.id; ERROR:  column reference "id" is ambi

Re: [GENERAL] Why UPDATE gl SET gl.glnum = gl.glnum; cause error when UPDATE gl SET glnum = glnum; is OK ?

2005-07-08 Thread Bruno Wolff III
On Fri, Jul 08, 2005 at 09:59:03 -0400, David Gagnon <[EMAIL PROTECTED]> wrote: > Hi all, > > I was juste wondering why the following code don't work: Because the value being set is a column name from the table being updated and you aren't allowed to qualify it with a table name. You don't rea

[GENERAL] Why UPDATE gl SET gl.glnum = gl.glnum; cause error when UPDATE gl SET glnum = glnum; is OK ?

2005-07-08 Thread David Gagnon
Hi all, I was juste wondering why the following code don't work: UPDATE gl SET gl.glnum = gl.glnum ERROR: column "gl" of relation "gl" does not exist While the following works: UPDATE gl SET glnum = glnum; Query returned successfully: 177 rows affected, 281 ms execution time. the TABLE.COLUMN