On Fri, May 30, 2003 at 16:03:44 -0700,
  jtx <[EMAIL PROTECTED]> 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';

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Reply via email to