Roger Baklund <[EMAIL PROTECTED]> wrote on 06/01/2005 12:25:31:

> Aji Andri wrote:
> > Hi all,
> > I'm make an inventory goods database, in one of my
> > table I need to make an automatic alert when my stock
> > reach it's limit (say for tires it's limit is 4), can
> > I make an automatic alert for it so when it reach it
> > limit I can have an alert may be a beep  ?
> 
> This is a typical task for the programming language/tool you are using 
> to create your application. What you ask may look a bit like a task for 
> a trigger, but triggers work serverside, and I assume you want the beep 
> on the client. I really think you would be better of just using a simple 

> script, running every 30 minutes or so. Something like this (meta code):
> 
> cnt = select stock from goods where goodstype='tires'
> if (cnt < 5):
>     beep()
>     send_email('[EMAIL PROTECTED]','Out of tires!')
> 
> (This script will of course keep beeping/sending emails every 30 minutes 

> until you stop the script or increase the registered stock above the 
> limit... )

Or, more generally, add a column "min_stock" to the table so that it will 
check all lines: 

> cnt = select stock from goods where stock < min_stock ;
> if (cnt < 5):
>     beep()
>     send_email('[EMAIL PROTECTED]','Restock needed for items....')


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to