On Aug 28, 2007, at 4:14 , hubert depesz lubaczewski wrote:

On Mon, Aug 27, 2007 at 06:36:47PM +0200, Claudia Kosny wrote:
Is there a way to do this with one query?
I am using PostgreSQL 7.4.

you can try to use "distinct on".

I considered that as well, but couldn't think of a way to return more than one row per "distinct on condition". I'd be interested to hear if you've thought of a way to use DISTINCT ON in this situation.


Michael Glaesemann
grzm seespotcode net



---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
      choose an index scan if your joining column's datatypes do not
      match

Reply via email to