From: Giampiero Raschetti <Giampiero.Raschetti@popso.it>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] PgSQL 6.5.1 and Group BY pb
Date: Wed, 25 Aug 1999 16:12:24 +0200
Message-ID: <37C3F9C8.BB2E42DF@popso.it> (raw)
References: <l03130304b3e996ea9e0d@[147.233.159.109]>
Herouth Maoz wrote:
>
> At 14:08 +0300 on 25/08/1999, Giampiero Raschetti wrote:
>
> > ...............................
>
> I think you have a misunderstanding about the purpose of group by statements.
>
> In fact, the above seems to indicate that you are not well aware of what
> joins are, or at least you don't know that you have to restrict them to
> make sense of your data. You really have to add WHERE g.id = u.id.
>
OK. That's true. I'm not well aware of SQL in general but if you
try out that secuence into postgres 6.4.2 you will see that it works.
So I understand that probably it was not standard. Well.
Let's take a look at this same problem without any join involved
and if possible let me know how to obtain my target:
xaxa=> \d comuni
Table = comuni
+----------------------------------+----------------------------------+-------+
| Field | Type |
Length|
+----------------------------------+----------------------------------+-------+
| produtt | varchar()
| 40 |
| unital | varchar()
| 40 |
| comune | varchar()
| 40 |
| login | varchar()
| 8 |
+----------------------------------+----------------------------------+-------+
xaxa=> select * from comuni;
produtt| unital|comune |login
-------+---------------+------------+-----
xxx |199900200000100|POGGIRIDENTI|user1
yyy |199900200000100|POGGIRIDENTI|user2
yyy |199900200000100|ARDENNO |USER3
yyy |199900200000100|BORMIO |user2
(4 rows)
xaxa=> select * from comuni group by login;
ERROR: Illegal use of aggregates or non-group column in target list
xaxa=>
This works too on Postgres 6.4.2 so how can I obtain a list of
unique users from this table on 6.5.1 ?
Many Thanks
--
Best Regards
----------------------------
Giampiero Raschetti
Sistemi Innovativi
Banca Popolare di Sondrio
----------------------------
Attachments:
smime.p7s (application/x-pkcs7-signature, 1.9K) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: Giampiero.Raschetti@popso.it, herouth@oumail.openu.ac.il
Subject: Re: [SQL] PgSQL 6.5.1 and Group BY pb
In-Reply-To: <37C3F9C8.BB2E42DF@popso.it>
References: <l03130304b3e996ea9e0d@[147.233.159.109]> <37C3F9C8.BB2E42DF@popso.it>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox