Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-09 Thread Madison Kelly
Grzegorz Jaśkiewicz wrote: On Tue, Dec 9, 2008 at 9:02 AM, Grzegorz Jaśkiewicz <[EMAIL PROTECTED]> wrote: or even, when you change bar to proper type - that is, timestamp SELECT distinct foo, min(bar) as minbar, max(bar) as maxbar FROM table WHERE bar < '2008-12-07 16:32:46' AND tbl_id=153 OR

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-09 Thread Madison Kelly
Grzegorz Jaśkiewicz wrote: On Mon, Dec 8, 2008 at 10:19 PM, Madison Kelly <[EMAIL PROTECTED]> wrote: Hi all, I've got a table that I am trying to SELECT DISTINCT on one column and ORDER BY on a second column, but am getting the error: SELECT DISTINCT ON expressions must match initial ORDER BY

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-09 Thread Grzegorz Jaśkiewicz
On Tue, Dec 9, 2008 at 9:02 AM, Grzegorz Jaśkiewicz <[EMAIL PROTECTED]> wrote: > or even, when you change bar to proper type - that is, timestamp > > SELECT distinct foo, min(bar) as minbar, max(bar) as maxbar FROM > table WHERE bar < '2008-12-07 > 16:32:46' AND tbl_id=153 ORDER BY bar LIMIT 1;

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-09 Thread Grzegorz Jaśkiewicz
On Mon, Dec 8, 2008 at 10:19 PM, Madison Kelly <[EMAIL PROTECTED]> wrote: > Hi all, > > I've got a table that I am trying to SELECT DISTINCT on one column and > ORDER BY on a second column, but am getting the error: > > SELECT DISTINCT ON expressions must match initial ORDER BY expressions try SE

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-09 Thread David Rowley
Adam Rich Wrote: > > > > > > When we get windowing functions, a lot of this pain will go away :) > > > > > > > Yes! Hope it won't be too long now. The patch seems to behave like it > > should > > now :) > > Hopefully we'll see it commited for 8.4. > > > > Though this does not look too much cleaner

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread Adam Rich
> > > > When we get windowing functions, a lot of this pain will go away :) > > > > Yes! Hope it won't be too long now. The patch seems to behave like it > should > now :) > Hopefully we'll see it commited for 8.4. > > Though this does not look too much cleaner at least it's standard SQL: > > A

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread David Rowley
Madison Kelly Wrote: > David Fetter wrote: > > On Mon, Dec 08, 2008 at 11:16:29PM -, David Rowley wrote: > >>> -Original Message- > >>> From: [EMAIL PROTECTED] [mailto:pgsql-general- > >>> [EMAIL PROTECTED] On Behalf Of Madison Kelly > >>> Sent: 08 December 2008 22:19 > >>> To: pgsql-ge

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread David Rowley
> -Original Message- > From: David Fetter [mailto:[EMAIL PROTECTED] > Sent: 09 December 2008 00:55 > To: David Rowley > Cc: 'Madison Kelly'; pgsql-general@postgresql.org > Subject: Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem > > On Mon, Dec 0

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread Madison Kelly
David Fetter wrote: On Mon, Dec 08, 2008 at 11:16:29PM -, David Rowley wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:pgsql-general- [EMAIL PROTECTED] On Behalf Of Madison Kelly Sent: 08 December 2008 22:19 To: pgsql-general@postgresql.org Subject: [GENERAL] SELECT DISTINC

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread David Fetter
On Mon, Dec 08, 2008 at 11:16:29PM -, David Rowley wrote: > > -Original Message- > > From: [EMAIL PROTECTED] [mailto:pgsql-general- > > [EMAIL PROTECTED] On Behalf Of Madison Kelly > > Sent: 08 December 2008 22:19 > > To: pgsql-general@postgresql.org > > Subject: [GENERAL] SELECT DISTIN

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread Madison Kelly
David Rowley wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:pgsql-general- [EMAIL PROTECTED] On Behalf Of Madison Kelly Sent: 08 December 2008 22:19 To: pgsql-general@postgresql.org Subject: [GENERAL] SELECT DISTINCT ... ORDER BY problem Hi all, I've got a table that I am

Re: [GENERAL] SELECT DISTINCT ... ORDER BY problem

2008-12-08 Thread David Rowley
> -Original Message- > From: [EMAIL PROTECTED] [mailto:pgsql-general- > [EMAIL PROTECTED] On Behalf Of Madison Kelly > Sent: 08 December 2008 22:19 > To: pgsql-general@postgresql.org > Subject: [GENERAL] SELECT DISTINCT ... ORDER BY problem > > Hi all, > >I've got a table that I am tr