Re: [SQL] subselect prob in view

2004-06-22 Thread Tom Lane
Gary Stainburn <[EMAIL PROTECTED]> writes: > The two selects work seperately, but I'm still getting the > syntax for the combined quiery wrong. What you've got here reduces to select co.co_r_id, co.count as com_count, cor.count as com_unseen from (select ...) co, (select ...) cor on co.co_

Re: [SQL] subselect prob in view

2004-06-22 Thread Stephan Szabo
On Tue, 22 Jun 2004, Gary Stainburn wrote: > On Monday 21 Jun 2004 4:11 pm, Gary Stainburn wrote: > > On Monday 21 Jun 2004 3:19 pm, Tom Lane wrote: > > > Gary Stainburn <[EMAIL PROTECTED]> writes: > > > > from requests r, users u, request_types t, > > > > request_states s, dealersh

Re: [SQL] subselect prob in view

2004-06-22 Thread Gary Stainburn
On Monday 21 Jun 2004 4:11 pm, Gary Stainburn wrote: > On Monday 21 Jun 2004 3:19 pm, Tom Lane wrote: > > Gary Stainburn <[EMAIL PROTECTED]> writes: > > > from requests r, users u, request_types t, > > > request_states s, dealerships d, departments de, customers c > > > lef

Re: [SQL] subselect prob in view

2004-06-21 Thread Gary Stainburn
On Monday 21 Jun 2004 3:19 pm, Tom Lane wrote: > Gary Stainburn <[EMAIL PROTECTED]> writes: > > from requests r, users u, request_types t, > > request_states s, dealerships d, departments de, customers c > > left outer join (select co_r_id, count(co_r_id) from comments > >

Re: [SQL] subselect prob in view

2004-06-21 Thread Tom Lane
Gary Stainburn <[EMAIL PROTECTED]> writes: > from requests r, users u, request_types t, > request_states s, dealerships d, departments de, customers c > left outer join (select co_r_id, count(co_r_id) from comments group > by co_r_id) co on > co.co_r_id = r.r_

[SQL] subselect prob in view

2004-06-21 Thread Gary Stainburn
Hi folks, I've got the view: create view nrequest_details as select r.r_id, r_registration, r.r_chassis, r.r_vehicle, r.r_fuel,r.r_pack_mats, r.r_delivery, r_delivery::date-now()::date as r_remaining, r.r_created, r.r_completed, d.d_des, de.de_des, u.u_id,