Re: Nested select

From: imad <immaad(at)gmail(dot)com>
To: hubert(dot)retif(at)i-netsoft(dot)ch
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Nested select
Date: 2006-11-06 19:07:10
Message-ID: 1f30b80c0611061107t48905e61jb975ffcbd2d1b34b@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Can you write the error message here?

--Imad
www.EnterpriseDB.com

On 11/6/06, Hubert Retif <hubert(dot)retif(at)i-netsoft(dot)ch> wrote:
>
>
>
>
> Hi,
>
>
>
> I am migrating my application from MySQL to Postgresql and have met
> following situation:
>
>
>
> SELECT
>
> (sum(sold_price)/(select sum(sold_price) from car_archive))*100 as CA_pcent,
>
> reason_text
>
> FROM car_archive
>
> group by reason_text
>
> order by CA_pcent desc
>
>
>
> works perfectly in MySQL, but not in Postgresql. The problem seems to be the
> nested select which should deliver a sum of the whole table, but it does
> not.
>
>
>
> If I replace this nested select with a fix value, then it works:
>
>
>
> SELECT
>
> (sum(sold_price)/(333))*100 as CA_pcent,
>
> reason_text
>
> FROM car_archive
>
> group by reason_text
>
> order by CA_pcent desc
>
>
>
> Has someone a solution for that situation?
>
>
>
> Thanks,
>
> Hubert Retif

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2006-11-06 19:18:45 Re: Composite Types
Previous Message Hubert Retif 2006-11-06 11:08:36 Nested select