Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-09 Thread Harald Fuchs
In article <4c0f4ba8.3040...@gmail.com>, Ognjen Blagojevic writes: > Plenty of solutions here: > http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ This doesn't mention the incredibly powerful windowing functions of PostgreSQL >= 8.4.0: SELECT username,

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-09 Thread Thom Brown
On 8 June 2010 17:29, Aaron Burnett wrote: > > Greetings, > > I hope this is the proper list for this, but I am a loss on how to achieve > one particular set of results. > > I have a table which is a list of users who entered a contest. They can > enter as many times as they want, but only 5 will

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-09 Thread Ognjen Blagojevic
Plenty of solutions here: http://www.xaprb.com/blog/2006/12/07/how-to-select-the-firstleastmax-row-per-group-in-sql/ -Ognjen On 8.6.2010 18:29, Aaron Burnett wrote: Greetings, I hope this is the proper list for this, but I am a loss on how to achieve one particular set of results. I have a

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-08 Thread Tim Landscheidt
Andy Colson wrote: >> thanks very much Andy. Very elegant. >> I do need to presere the users that have<5 entries though, so I think I can >> modify your function to do that as well. > Oh, duh! because nothing is less than 1900-01-01... my > date math sucks. It should probably return '2100-01

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-08 Thread Andy Colson
On 6/8/2010 2:08 PM, Aaron Burnett wrote: thanks very much Andy. Very elegant. I do need to presere the users that have<5 entries though, so I think I can modify your function to do that as well. Thanks again. Oh, duh! because nothing is less than 1900-01-01... my date math sucks. It s

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-08 Thread Andy Colson
On 6/8/2010 11:29 AM, Aaron Burnett wrote: Greetings, I hope this is the proper list for this, but I am a loss on how to achieve one particular set of results. I have a table which is a list of users who entered a contest. They can enter as many times as they want, but only 5 will count. So so

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-08 Thread Andy Colson
On 6/8/2010 11:29 AM, Aaron Burnett wrote: Greetings, I hope this is the proper list for this, but I am a loss on how to achieve one particular set of results. I have a table which is a list of users who entered a contest. They can enter as many times as they want, but only 5 will count. So so

Re: [GENERAL] Some insight on the proper SQL would be appreciated

2010-06-08 Thread Andy Colson
On 6/8/2010 11:29 AM, Aaron Burnett wrote: Greetings, I hope this is the proper list for this, but I am a loss on how to achieve one particular set of results. I have a table which is a list of users who entered a contest. They can enter as many times as they want, but only 5 will count. So so