dterrors@xxxxxxxxxxx wrote: > > I've just spent a few hours searching and reading about the postgres > way of selecting distinct records. I understand the points made about > the ORDER BY limitation of DISTINCT ON, and the abiguity of GROUP BY, > but I think there's a (simple, common) case that have been missed in > the discussion. Here is my sitation: Did you try putting the DISTINCT ON in a subselect, and the ORDER BY in an outer select? -- Alvaro Herrera http://www.CommandPrompt.com/ The PostgreSQL Company - Command Prompt, Inc. ---------------------------(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