Re: select id,count(imdb_id) problem - Mailing list pgsql-novice

From Ntina Papadopoulou
Subject Re: select id,count(imdb_id) problem
Date
Msg-id 4439F28B.5020408@freemail.gr
Whole thread Raw
In response to Re: select id,count(imdb_id) problem  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Responses Re: select id,count(imdb_id) problem  ("A. Kretschmer" <andreas.kretschmer@schollglas.com>)
Re: select id,count(imdb_id) problem  (Bruno Wolff III <bruno@wolff.to>)
List pgsql-novice
O/H A. Kretschmer έγραψε:
> am  10.04.2006, um  8:28:12 +0300 mailte Ntina Papadopoulou folgendes:
>
>> Hello community!
>>
>> When I type a query in postgresql, like
>>
>> select id,imdb_id,count(imdb_id) from "Movies" where id<10 group by
>> imdb_id;
>>
>> it says: column "Movies.id" must appear in the GROUP BY clause or be used
>> in an aggregate function
>> Where is the error?
>>
>
> The column 'Movies.id' isn't in the group by clause.
>
>
>
>> What is the right spelling of this query?
>>
>
> select id,imdb_id,count(imdb_id) from "Movies" where id<10 group by id,imdb_id;
>
>
> HTH, Andreas
>
Thnx a lot Andreas, but the query you gave me has not the desired result.
when i select id,imdb_id,count(imdb_id) from "Movies" where id<10 group
by imdb_id,id order by id asc;
what I get is
id | imdb_id | count
----+---------+-------
1 | 315733 | 1
2 | 315733 | 1
3 | 315733 | 1
4 | 315733 | 1
5 | 315733 | 1
6 | 315733 | 1
7 | 315733 | 1
8 | 315733 | 1
9 | 315733 | 1

The desired result is
something like
id | imdb_id | count
----+---------+-------
1 | 315733 | 9
10 | 335753 | 1
11 | 320000 | 15
etc.

____________________________________________________________________
http://www.freemail.gr - ������ �������� ������������ ������������.
http://www.freemail.gr - free email service for the Greek-speaking.

pgsql-novice by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: select id,count(imdb_id) problem
Next
From: "A. Kretschmer"
Date:
Subject: Re: select id,count(imdb_id) problem