Re: select where in and order

From: Chris <dmagick(at)gmail(dot)com>
To: Tony Smith <quickcur(at)yahoo(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select where in and order
Date: 2006-03-10 02:45:48
Message-ID: 4410E85C.3000904@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Tony Smith wrote:
> I have two tables action and group:
>
> action
> ------------------------
> id,
> name
>
> group:
> ------------------------
> action_id
> rank
>
> I what to select from action table by order by the
> rank in the group table.
>
> If I use
>
> select * from action where id in (select action_id
> from group order by rank)

Why not

select * from action a, group g where a.id=g.action_id order by rank desc;

?

--
Postgresql & php tutorials
http://www.designmagick.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2006-03-10 02:47:52 Re: select where in and order
Previous Message Roger Hand 2006-03-10 02:43:25 Re: select where in and order