Re: linking columns

2001-07-02 Thread Sebastiaan J.A. Kamp

Daniel,

This would be a 'contre-coeur' to any database...

If you want some output like this, make it so in your query:
SELECT *, (column_1 * column_2) AS column_3 FROM table;

If you actually want to store the result of the calculation, do it in your
insert query; However, a 'dynamic value' database content is bogus...


Regards,

Sebastiaan J.A. Kamp

- Original Message -
From: Daniel Leal [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, July 01, 2001 12:13 PM
Subject: linking columns


 Hi everyone!

 I'm starting with mysql!
 I wish to know if it is possible to make a table that has to columns
linked by
 a mathematic expression. For example:
 My table is my_tbl;
 And it has three colums: column_1, column_2 and column_3;
 Every column have int or float values;
 And for example, I want that the third column always be
 equal to column_1 * column_2;
 So when I change a value in column_1 or column_2, then column_3 will be
change
 imediatly by mysql!

 Is that possible?
 how can I do it?

 Thanks...
 Daniel

 -
 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




-
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




Re: linking columns

2001-07-01 Thread Bob Hall

Hi everyone!

I'm starting with mysql!
I wish to know if it is possible to make a table that has to columns linked by
a mathematic expression. For example:
My table is my_tbl;
And it has three colums: column_1, column_2 and column_3;
Every column have int or float values;
And for example, I want that the third column always be
equal to column_1 * column_2;
So when I change a value in column_1 or column_2, then column_3 will be change
imediatly by mysql!

Is that possible?
how can I do it?

Thanks...
Daniel

Sir, use a query to return calculated columns. Don't put them in 
tables unless you're going to delete or replace the values the 
calculation was based on and you need to store the results of the 
calculation.

Bob Hall

 [EMAIL PROTECTED]
  Know thyself? Absurd direction!
 Command 'know' not recognized.
Drat. I wanted a list server and got an epistemological skeptic instead.
MySQL secret passwords: sql query database 

-
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