Re: [GENERAL] referring to calculated column in sub select

2009-05-21 Thread Scott Bailey
Hi, why column "acoltest" is not found by the subselect in this select: SELECT acol + 100 as acoltest, (select max(t) from mytab where anothercol=acoltest) as col2 FROM mytab2 group by somet ??? Only columns belonging to a table can be used in a subselect??? What about "calculated

Re: [GENERAL] referring to calculated column in sub select

2009-05-19 Thread Sam Mason
On Tue, May 19, 2009 at 12:04:28AM -0700, Scara Maccai wrote: > Using Mysql the query works, so I expected it to be somehow "standard" > (I know, Mysql sometimes allows much more than the standard...) No, as far as I know the standard explicitly says that the MySQL behaviour is incorrect. > Does

Re: [GENERAL] referring to calculated column in sub select

2009-05-19 Thread Scara Maccai
you --- Lun 18/5/09, Sam Mason ha scritto: > Da: Sam Mason > Oggetto: Re: [GENERAL] referring to calculated column in sub select > A: pgsql-general@postgresql.org > Data: Lunedì 18 maggio 2009, 19:10 > On Mon, May 18, 2009 at 06:49:30AM > -0700, Scara Maccai wrote: > > why c

Re: [GENERAL] referring to calculated column in sub select

2009-05-18 Thread Sam Mason
On Mon, May 18, 2009 at 06:49:30AM -0700, Scara Maccai wrote: > why column "acoltest" is not found by the subselect in this select: The "acoltest" identifier is only visible from outside the query, not within its defining query or any of its sub-queries. If you're trying to solve a problem like t

[GENERAL] referring to calculated column in sub select

2009-05-18 Thread Scara Maccai
Hi, why column "acoltest" is not found by the subselect in this select: SELECT acol + 100 as acoltest, (select max(t) from mytab where anothercol=acoltest) as col2 FROM mytab2 group by somet ??? Only columns belonging to a table can be used in a subselect??? What about "calculated"