Re: Comments on subquery performance - Mailing list pgsql-sql

From Richard Huxton
Subject Re: Comments on subquery performance
Date
Msg-id 4214ED42.5040802@archonet.com
Whole thread Raw
In response to Comments on subquery performance  ("T- Bone" <jbowen333@hotmail.com>)
Responses Re: Comments on subquery performance
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: pg primary key bug?
Next
From: pginfo
Date:
Subject: Re: pg primary key bug?