Re: join/case
От | Bruno Wolff III |
---|---|
Тема | Re: join/case |
Дата | |
Msg-id | 20030531130831.GA31995@wolff.to обсуждение исходный текст |
Ответ на | join/case ("jtx" <jtx@hatesville.com>) |
Список | pgsql-sql |
On Fri, May 30, 2003 at 16:03:44 -0700, jtx <jtx@hatesville.com> wrote: > Basically, I have something like this: > > Select o.id,o.num_purch,o.program from orders o left join lists l on > l.order_id=o.id where o.uid=1 and o.status!='closed' > > However, I want to throw an extra conditional in there that says if > l.status='processing', then don't return anything. So, I tried: The straight forward way to do this is do just do what you described. Make the join a subselect (keeping l.status) and then select from that where status <> 'processing. The result looks like: select id, num_purch, program from (select o.id,o.num_purch,o.program,l.status from orders o left join lists l on l.order_id=o.id where o.uid=1 and o.status!='closed') as j where status <> 'processing';
В списке pgsql-sql по дате отправления: