SELECT DISTINCT ON bug?

From: Jean-Christian Imbeault <jc(at)mega-bucks(dot)co(dot)jp>
To: pgsql-general(at)postgresql(dot)org
Subject: SELECT DISTINCT ON bug?
Date: 2003-05-21 06:35:37
Message-ID: 3ECB1E39.7080309@mega-bucks.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

The following query give an error in 7.3

TAL=# SELECT distinct on(dai_genres.id), dsc from dai_genres,
rel_genres_goods where dai_genres.id=rel_genres_goods.major_id group by
id, dsc;
ERROR: parser: parse error at or near "," at character 34

I looked up the 7.3 docs and I thought I had the syntax right.

What's the proper syntaxt for the above query (selecting unique id's and
their associated dsc from the two tables joined on id=major_id)

Thanks.

PS I was doing this query using GROUP BY but using distinct (on) seems
like it should be faster, but I can't test it until I get the query
running ...

--

Jean-Christian Imbeault

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Shridhar Daithankar 2003-05-21 06:36:36 Re: [GENERAL] pam-linux, /etc/shadow : HOW-TO
Previous Message Martijn van Oosterhout 2003-05-21 05:24:42 Re: PRIMARY KEYS