From: | Phong & Ronni Bounmixay <bounmixay(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, jimw(at)kelcomaine(dot)com |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: sub select as a data column |
Date: | 2005-11-28 22:44:13 |
Message-ID: | 7838141f0511281444u7560a0c2haf26be2f1d52cccb@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
You both are SO right! I sent that off and tried a couple of things and
realized I was close but not close enough. I really appreciate the kind
responses. Sometimes it's so hard to ask a question without feeling so
foolish and then feeling worse when the answers are sarcastic. Thank you!
Good luck to you both! You do such a good job in this group!
Ronni
On 11/28/05, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Phong & Ronni Bounmixay <bounmixay(at)gmail(dot)com> writes:
> > I want to do in postgresql what I do in oracle:
>
> > select year report_year,
> > sum(amount),
> > sum(select amount from my_table where year <= report_year)
> > from my_table
> > group by report_year;
>
> That doesn't really work in Oracle does it? It violates the SQL spec
> in at least three ways. Try something like
>
> select year as report_year,
> sum(amount),
> sum((select amount from my_table b where b.year <= a.year))
> from my_table a
> group by year;
>
> (which should work in Oracle too, or any other SQL-spec-compliant
> database). Note the extra parentheses ... they're not optional.
>
> regards, tom lane
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Gagnon | 2005-11-28 22:51:41 | BUG when migrating from 8.0 to 8.1 with create temp table |
Previous Message | Jim C. Nasby | 2005-11-28 22:43:33 | Re: Set a blank password for a db user |