[SQL] Is there anyway to...

2006-11-06 Thread louis gonzales

Hello all,
Is there an existing mechanism is postgresql that can automatically 
increment/decrement on a daily basis w/out user interaction?  The use 
case I'm considering is where a student is in some type of contract with 
an instructor of some sort, and that contract puts a time limit on the 
student requiring her to pay a fee by a certain day.  IF that day comes 
to pass - or a certain number of days elapse - and that payment 
requirement hasn't been met, I want to trigger a function.


The one requirement I want to impose is, that no end user of the DB 
application, needs to do anything to set the trigger, other than the 
initialization of making the student of this type.


An example would be:
Day1 - Application user(typically the instructor) creates a profile for 
a new student - John Doe, which sets a 30 day time limit for John Doe to 
pay $100.00

Day2 - Day31 - John Doe didn't make the payment
Day 31 - Trigger of event occurs when the instructor logs in.

Basically on Day 1 when John Doe's profile was created, I want a 
decrement counter to occur daily on his profile(some attribute/timer) 
and nothing should happen until day 31 when he doesn't pay.


Any ideas?

--
Email:[EMAIL PROTECTED]
WebSite:  http://www.linuxlouis.net
Open the pod bay doors HAL! -2001: A Space Odyssey
Good morning starshine, the Earth says hello. -Willy Wonka


---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [SQL] Is there anyway to do this?

2002-10-18 Thread Bruno Wolff III
On Fri, Oct 18, 2002 at 12:45:56 -0400,
  Wei Weng [EMAIL PROTECTED] wrote:
 I have a table 
 
Table Users
   Column   |  Type  | Modifiers 
 ---++---
  userid| character varying(40)  | not null
  username  | character varying(64)  | 
 
 I want to get all the distinct first character of all usernames. And do
 it in a way that is the most portable to MS SQL server.
 
 Is there anyway?

Looking through the documentation on string functions would be helpful.
An example solution is:
select distinct substring(username from 1 for 1) from users;

---(end of broadcast)---
TIP 6: Have you searched our list archives?

http://archives.postgresql.org