Re: newbie sql question: select every day another quote

From: Janning Vygen <vygen(at)planwerk6(dot)de>
To: "Len Morgan" <len-morgan(at)crcom(dot)net>
Cc: "PostgreSQL-General" <pgsql-general(at)postgresql(dot)org>
Subject: Re: newbie sql question: select every day another quote
Date: 2001-05-12 13:01:49
Message-ID: 01051215014903.29826@janning
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Am Samstag, 12. Mai 2001 14:37 schrieb Len Morgan:
> >lastdayshown is always null on insert.
> >works fine. Now i want to select every day a different quote.
> >
> >Is it possible to
> >select the row with lastdayshown = today
>
> SELECT * FROM quotes WHERE lastdayshown = now()::date ;
>
> >if no result

Hi,

thanks for your answer
i already manages this part :-)

> The "no result part" is harder. You'll have to have some sort of client
> program that can tell you if the above quote returned a row or not. Once
> you have that, if the above query did NOT return a row, you can use the
> following two steps:
>
> UPDATE quotes SET lastdayshown = now():: WHERE oid = (SELECT oid FROM
> quotes WHERE lastdayshown IS NULL LIMIT 1) ;

i managed this now in php. works fine
but the idea was to put this structure into the database, so the db user just
have to send one select and once a day there is an automagical update.

maybe its not possible...

thanks
janning

--
Planwerk 6 /websolutions
Herzogstraße 86
40215 Düsseldorf

fon 0211-6015919
fax 0211-6015917
http://www.planwerk6.de

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tod McQuillin 2001-05-12 13:30:00 Re: newbie sql question: select every day another quote
Previous Message Alexander Dederer 2001-05-12 10:23:30 Bug with timestamp !!!