Re: [SQL] PgSQL 6.5.1 and Group BY pb
От | Giampiero Raschetti |
---|---|
Тема | Re: [SQL] PgSQL 6.5.1 and Group BY pb |
Дата | |
Msg-id | 37C3F9C8.BB2E42DF@popso.it обсуждение исходный текст |
Ответ на | Re: [SQL] PgSQL 6.5.1 and Group BY pb (Herouth Maoz <herouth@oumail.openu.ac.il>) |
Список | pgsql-sql |
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 ----------------------------
В списке pgsql-sql по дате отправления: