Re: [SQL] join/case

2003-05-31 Thread Bruno Wolff III
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 th

Re: [SQL] join/case

2003-05-31 Thread Stephan Szabo
On Fri, 30 May 2003, jtx wrote: > Hi everyone, I'm trying to do a left join on two tables, mainly because > data from table 'b' (lists) may or may not exist, and if it doesn't I > want results. However, if data from table lists DOES exist, I want to > run a conditional on it, and then return dat

Re: [SQL] join/case

2003-05-31 Thread Dmitry Tkach
I think, something like this should work: select o.id,o.num_purch,o.program from orders o left join lists l on (l.order_id=o.id) where (l.status is null or l.status!='processing') and o.uid=1 and o.status!='closed'. (l.status is null should take care about the case when there is no matching row