Re: Group by problem!

From: Grzegorz Jaśkiewicz <gryzman(at)gmail(dot)com>
To: shahrzad khorrami <shahrzad(dot)khorrami(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Group by problem!
Date: 2009-11-04 11:19:08
Message-ID: 2f4958ff0911040319g6a546e09x19d6b447a2de2a1f@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 4, 2009 at 9:11 AM, shahrzad khorrami <
shahrzad(dot)khorrami(at)gmail(dot)com> wrote:

>
> hi all,
>
>
>
>
> Column | Type |
> Modifiers
>
> --------+-----------------------+---------------------------------------------------
> id | integer | not null default
> nextval('test_id_seq'::regclass)
> f1 | character varying(32) |
> f3 | character varying(32) |
> f4 | character varying(32) |
> f5 | character varying(32) |
> f6 | character varying(32) |
> f7 | character varying(32) |
> f8 | character varying(32) |
> f9 | character varying(32) |
> f11 | character varying(32) |
> f12 | character varying(32) |
> f13 | character varying(32) |
> f14 | character varying(32) |
> f2 | character varying(32) |
> f10 | character varying(32) |
>
> 512 | 432350221818600,355801020050525 | A | 43.28 | N | -80.07 | E | 08
> | 0.05 | 1381.0 | 48.28 | 1/4042 | 24/0 | 082234 | 121109
> 513 | 432350221818600,355801020050525 | A | 43.28 | N | -80.07 | E | 08
> | 0.05 | 1381.0 | 48.28 | 1/4042 | 24/0 | 082234 | 121109
> 521 | 432350221818600,355801020050524 | A | 43.28 | N | -80.07 | E | 08
> | 0.05 | 1381.0 | 48.28 | 1/4042 | 24/0 | 192213 | 121109
> 523 | 432350221818600,355801020050524 | A | 43.28 | N | -80.07 | E | 08
> | 0.05 | 1381.0 | 48.28 | 1/4042 | 24/0 | 092213 | 121109
> 577 | 432350221818600,355801020050525 | A | 43.28 | N | -80.07 | E | 08
> | 0.05 | 1381.0 | 48.28 | 1/4042 | 24/0 | 082234 | 121109
> ...
>
> select * from test where id in( SELECT id FROM test
> WHERE f1 in *('432350221818600,355801020050524','432350221818600,355801020050525')
> *
> GROUP BY f1
> HAVING MAX(f10::int)>1 and MAX(f2::int)>1);
>
> but this query raised an error:
>
> ERROR: column "test.id" must appear in the GROUP BY clause or be used in
> an aggregate function
> LINE 1: select * from test where id in( SELECT id FROM test
>
>
it is quite obvious, isn't it ?
btw, is that db a joke ?
You obviously don't expect that to be fast, ever.

--
GJ

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Sam Mason 2009-11-04 11:51:41 Re: Group by problem!
Previous Message Wojtek 2009-11-04 11:05:33 Re: --//pgsql partitioning-///--------------------