Re: [SQL] problem with subqueries

2002-10-06 Thread Stephan Szabo
On Sun, 6 Oct 2002 [EMAIL PROTECTED] wrote: > Hi guys. Thanks for the rapid replies so far. > > To answer some of the questions: > > >you did not indicate an explicit join - or even a "from" clause for that > >matter- in the example of your create view statement. > > My original post was a simpl

Re: [SQL] problem with subqueries

2002-10-06 Thread pete
Hi guys. Thanks for the rapid replies so far. To answer some of the questions: >you did not indicate an explicit join - or even a "from" clause for that >matter- in the example of your create view statement. My original post was a simplified version. Here is the actual view creating statement:

Re: [SQL] problem with subqueries

2002-10-05 Thread Stephan Szabo
On Sat, 5 Oct 2002 [EMAIL PROTECTED] wrote: > Because I want to obtain a monthly breakdown, I created a view called > monthcustomer as this select: > > select orders.ord_date, customer.cname, > date_part('month',orders.ord_date) AS "month", > date_part('year',orders.ord_date) A

Re: [SQL] problem with subqueries

2002-10-05 Thread Tom Lane
[EMAIL PROTECTED] writes: > select distinct year,month, > (select sum(monthcustomer.number_of_items) from monthcustomer where > monthcustomer.year=m.year and monthcustomer.month=m.month) as NumPots > from monthcustomer m; > This goes off and never comes back - No surpr

[SQL] problem with subqueries

2002-10-05 Thread pete
Hi Any help appreciated - I have spent 2 days trying to get this query to work! I have an orders database and a customer database. The orders database has a date field for each order. Because I want to obtain a monthly breakdown, I created a view called monthcustomer as this select: