SELECT DISTINCT ON bug? - Mailing list pgsql-general

From Jean-Christian Imbeault
Subject SELECT DISTINCT ON bug?
Date
Msg-id 3ECB1E39.7080309@mega-bucks.co.jp
Whole thread Raw
Responses Re: SELECT DISTINCT ON bug?
List 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


pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: PRIMARY KEYS
Next
From: "Shridhar Daithankar"
Date:
Subject: Re: pam-linux, /etc/shadow : HOW-TO