pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Richard Huxton <dev@archonet.com>
To: T- Bone <jbowen333@hotmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Comments on subquery performance
Date: Thu, 17 Feb 2005 19:15:14 +0000
Message-ID: <4214ED42.5040802@archonet.com> (raw)
In-Reply-To: <BAY103-F17FF599D1FD15D1E06780BE76D0@phx.gbl>
References: <BAY103-F17FF599D1FD15D1E06780BE76D0@phx.gbl>

T- Bone wrote:
> (second attempt in two days to post this message...I appologise if for 
> some reason a duplicate appears)
> 
> Hello all,
> 
> I created a query that contains two subqueries and joins and would like 
> some feedback on whether:
>  1) this approach is logical; and,
>  2) if this is an optimal approach (performance wise) to return the 
> records I seek.

Well you could just do:

SELECT
   l.*, c1.catname, c2.catname, c3.catname
FROM
   tbl_listing l,
   tbl_categories c1,
   tbl_categories c2,
   tbl_categories c3
WHERE
   l.catid1 = c1.catid
   AND l.catid2 = c2.catid
   AND l.catid3 = c3.catid

-- 
   Richard Huxton
   Archonet Ltd



view thread (6+ messages)  latest in thread

Message-ID: <4214ED42.5040802@archonet.com>
Permalink:  ../4214ED42.5040802@archonet.com/
Also on:    postgresql.org/message-id/4214ED42.5040802@archonet.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: dev@archonet.com, jbowen333@hotmail.com
  Subject: Re: Comments on subquery performance
  In-Reply-To: <4214ED42.5040802@archonet.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox