Re: Some insight on the proper SQL would be appreciated

From: Tim Landscheidt <tim(at)tim-landscheidt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Some insight on the proper SQL would be appreciated
Date: 2010-06-09 00:26:42
Message-ID: m3y6epdpa5.fsf@passepartout.tim-landscheidt.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andy Colson <andy(at)squeakycode(dot)net> 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-01' or
> something.

If you're using stored functions, you could (and should be-
cause the whole table is probably read anyhow) also code a
function that reads all entries, resets a counter at the
start and whenever the user changes, increments it on every
row and returns all rows where the counter is less than
five.

Tim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Robert Haas 2010-06-09 03:04:12 Re: BUG #5492: Query performs slowly and sequence corrupted
Previous Message Vick Khera 2010-06-08 22:29:39 Re: Queues Problem