Re: [GENERAL] Reuse of Subselects

2004-02-17 Thread Bruno Wolff III
On Tue, Feb 17, 2004 at 13:02:43 +0100, Holger Marzen <[EMAIL PROTECTED]> wrote: > Hi all, > > if I have something like this: > > SELECT column1, >(... complicated subselect ...), >column1 - (... same subselect as above ...) > FROM table1; > > do I really have to rewrite the su

Re: [GENERAL] Reuse of Subselects

2004-02-17 Thread P.J. \"Josh\" Rovero
temporary tables work. Save the complicated subselect in temporary table, following queries just simple select on temp table. Holger Marzen wrote: Hi all, if I have something like this: SELECT column1, (... complicated subselect ...), column1 - (... same subselect as above ...) FRO

Re: [GENERAL] Reuse of Subselects

2004-02-17 Thread Martijn van Oosterhout
Depend in the exact query, you can do: SELECT column1, x.c, column1-x.c FROM table1, (... complicated subselect ...) as x; The above may not work if they're correlated, so you can try: SELECT column1, column2, column1-column2 FROM (SELECT column1, (... complicated subselect ...) as column2

[GENERAL] Reuse of Subselects

2004-02-17 Thread Holger Marzen
Hi all, if I have something like this: SELECT column1, (... complicated subselect ...), column1 - (... same subselect as above ...) FROM table1; do I really have to rewrite the subselect a 2nd time if I need that result in another column's expression? ---(e