Re: Some insight on the proper SQL would be appreciated - Mailing list pgsql-general

From Tim Landscheidt
Subject Re: Some insight on the proper SQL would be appreciated
Date
Msg-id m3y6epdpa5.fsf@passepartout.tim-landscheidt.de
Whole thread Raw
In response to Re: Some insight on the proper SQL would be appreciated  (Andy Colson <andy@squeakycode.net>)
List pgsql-general
Andy Colson <andy@squeakycode.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

pgsql-general by date:

Previous
From: Vick Khera
Date:
Subject: Re: Queues Problem
Next
From: John Gage
Date:
Subject: Re: Cognitive dissonance