Why do you want to store the results of a calculation?
Don't store the results of a calculation, instead do the calculation when
you are retreiving data.
For example "SELECT field1, field2, field1 + field2 AS sum_of_the_two_fields
FROM your_table"

Also, it is a good idea to give good names to your fields. Not Field1,
Field2, .... Your names are very confusing.
It is like giving birth to three boys and you name them Boy1, Boy2, Boy3
!!!!!!!! Would you do that?????

The last question will be why you defined the fields as VARCHAR while it
seems they will be holding numeric values.
If the will be holding INTEGERs or FLOATs, define them accordingly. The
manual will easily teach you about the data and field types.


Hope this will help you
Thanks

Emery
----- Original Message -----
From: "daryl hansen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, December 27, 2003 10:59
Subject: newbie question about calculations


> Please excuse me if I do not use the correct terminology for what I am
> trying to descibe. I am new to mySQL and am using FileMaker and Lass to
> export Filemaker data for use with mySQL. How do you make a field that
> is the sum of two other fields in the same record? I have riffled
> through the mySQL manual, but I still have no clue on how to make
> calculation fields. Right now I have FileMaker talking to mySQL 4.0.15
> using the JDBC driver and a SQL plug-in for Filemaker.  And it is
> working very well, for static data, But....  Anyway, this is a sample
> of my current code to create my Table called, "cart":
>
> CREATE TABLE Cart (
> ID bigint(20) NOT NULL auto_increment ,
> Field1 varchar (5) ,
> Field2 varchar (5) ,
> Field3 varchar (5) ,
>              KEY `ID` (`ID`)
> )
>
> And code to input data into the table:
>
> INSERT INTO cart (
> Field1,
> Field2,
> Field3  )
> VALUES ( '1', '1', '2')
>
>
> How do I make "Field3" a calculation, which equals 2 if fields 1 & 2
> where values set to "1"? Any pointers in the right direction would be
> sincerely appreciated.
>
> Aloha,
>
> Daryl Hansen
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>
>
>



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

Reply via email to