Re: newbie sql question: select every day another quote
От | Tod McQuillin |
---|---|
Тема | Re: newbie sql question: select every day another quote |
Дата | |
Msg-id | Pine.GSO.4.31.0105120826360.1166-100000@sysadmin обсуждение исходный текст |
Ответ на | Re: newbie sql question: select every day another quote (Janning Vygen <vygen@planwerk6.de>) |
Список | pgsql-general |
On Sat, 12 May 2001, Janning Vygen wrote: > Am Samstag, 12. Mai 2001 14:37 schrieb Len Morgan: > > 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. It will probably work to make a plpgsql function doing something like: 1. Figure out the primary key of today's quote 2. Update the database if necessary 3. Return the key of today's quote then you can SELECT * from quotes WHERE key = todays_key(); -- Tod McQuillin
В списке pgsql-general по дате отправления: