-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Seifuddin, Lamar T.* (LSEIFUDD) wrote:
| Hello All,
|
| I am using mysql on Linux - RedHat 7.1.
| The basic stuff is simple, cool, too.
|
| I am a newbie, so forgive me if this is too simple a question.
|
| Is there a mechanism available somewhere in doing an "automated"
update of a
| field.
|
| example.
|
| team is a table.
|
| wins, losses, pct are fields of team table.
|
| I want to enter wins and/or losses and have pct be automatically updated.
|
| where pct is wins/(wins + losses)
|
| or do I have to write a script (not lazy, just wanted to know if something
| was available)
|
| I appreciate any advice or direction.

What you're talking about is a trigger. MySQL doesn't have them yet. In
general they're used inappropriately anyways. This example would be an
inappropriate use (in most cases). Simply compute the "pct" field when
you do your queries:

~ SELECT wins, losses, wins / (wins + losses) as pct FROM team

        -Mark
- --
For technical support contracts, visit https://order.mysql.com/?ref=mmma

~    __  ___     ___ ____  __
~   /  |/  /_ __/ __/ __ \/ /  Mark Matthews <[EMAIL PROTECTED]>
~  / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer - JDBC/Java
~ /_/  /_/\_, /___/\___\_\___/ Flossmoor (Chicago), IL USA
~        <___/ www.mysql.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.1.90 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQE9UtVvtvXNTca6JD8RAn3BAKCCYFuHTd4n7tEVhyowe8E6pt7RzACgmtw+
WJvOchcYHV8c0rON8Lzom3Y=
=7JJY
-----END PGP SIGNATURE-----


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to