Jump to content

Recommended Posts

I have a quick question with respect to calculations within a table.  For example, let's use the following table:

 

hour

|

load GT1

|

load GT2

|

load ST

|

total

1

|

30

|

30

|

0

|

(sum of load GT1, GT2, ST)

2

|

40

|

20

|

3

|

(sum of load GT1, GT2, ST)

 

Is there a function or calculation I can add right in the mysql table under total, to automatically add the sum of the other columns?  I'd like to have mysql do it instead of adding to the PHP code - maybe just to skip a few steps??

 

Let me know if you need any more information. 

Thanks in advance!

 

~C.

Link to comment
https://forums.phpfreaks.com/topic/150664-calculations-from-within-a-table/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.