Re: [GENERAL] self-join on subselect

2005-01-27 Thread PFC
Thanks, I was hoping there was some way to avoid it. You have to write the subselect twice if you want to match up different rows. In some cases it might be worth making a copy in a temp table. For simple subselects where there is an index on id, leaving it as is should work fine. ---

Re: [GENERAL] self-join on subselect

2005-01-26 Thread Bruno Wolff III
On Wed, Jan 26, 2005 at 23:12:25 +0100, PFC <[EMAIL PROTECTED]> wrote: > > How do you do a self-join on a subselect ? > > like > SELECT a.x+b.x FROM (subselect) a, (subselect) b WHERE a.id = b.id+10 > > but without performing the subselect twice >

Re: [GENERAL] self-join on subselect

2005-01-26 Thread Jim C. Nasby
It's not at all clear what you're asking. Do you have a real example, preferably with EXPLAIN output? On Wed, Jan 26, 2005 at 11:12:25PM +0100, PFC wrote: > > How do you do a self-join on a subselect ? > > like > SELECT a.x+b.x FROM (subselect) a, (subselect) b WHERE a.id = b.i

[GENERAL] self-join on subselect

2005-01-26 Thread PFC
How do you do a self-join on a subselect ? like SELECT a.x+b.x FROM (subselect) a, (subselect) b WHERE a.id = b.id+10 but without performing the subselect twice ..? ---(end of broadcast)--- TIP 9