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 some users have
one entry, some have as many as 15.



is it possible to add a new column:  "isValid integer"

(or something like it, to signify which one's can and cannot be selected)

I was thinking of doing it in two steps, an update to set isValid, then a select with just "isValid = 1". Not sure how hard the update would be though.

Oh, wait, I'll bet a window function would be helpful... but you are on 8.2 so I dont think you have them.

I can think of a stored proc that might work, that ok?

Oh, another thought.. if we order it by username, signedup, and then did something like:

where ... signedup > (select the 5th signedup from users ... )

not 100% how to do the subselect though. I can see min(signedup) or max(signedup), but not sure how to get the 5th.

Not real helpful, sorry, just some random thoughts

-Andy

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to