[Dbix-class] Using 'DISTINCT ON' clause in select statement

Jess Robinson castaway at desert-island.demon.co.uk
Sat Aug 19 11:50:53 CEST 2006



On Fri, 18 Aug 2006, Paul Henrich wrote:

> On Aug 18, 2006, at 3:55 PM, Brandon Black wrote:
>> 
>> On 8/18/06, Paul Steinkamp <steinkam at apple.com> wrote:
>> Greetings,
>> 
>> Can't the same effect be achieved with GROUP BY?
>> 
>> -- Brandon
>
> I just ran into this myself.
>
> It seems postgres has a strange syntax/behavior for GROUP BY that becomes 
> difficult to work with when using SQL::Abstract and when working with joined 
> tables. Basically, any column you select must be used in the GROUP BY or in 
> an aggregate function. In my case I was (fortunately) able to simplify things 
> by just by setting distinct => 1.

Strange behaviour? That's quite normal and sane..

/me curses DBs that teach people non-ansi rubbish.

Jess




More information about the Dbix-class mailing list