Page 1 of 1

Adding the contents of several fields within 1 record

Posted: Wed Mar 21, 2007 2:16 pm
by ippykinippy
I'm hoping someone can direct me to the right search string for the following:

I'm creating an online Timesheet (time tracking form for music instructors) using php/mysql.

I have several columns in my timesheet table for entering the hours an instructor has worked: "Admin-time", "Prep-time", "Class-time", etc. I'd like to add all of these into another column called "Total-Time".

I don't even know what words to search for. I tried for hours here and came up with nothing related.

I'm positive my ignorance is blinding and just hope for a little gesture in the right direction.

cheers,

ippy

Posted: Wed Mar 21, 2007 2:31 pm
by feyd
It would be an UPDATE query. If done correctly, it wouldn't have a thing to do with PHP.

Posted: Wed Mar 21, 2007 2:45 pm
by mikeq
In general you wouldnt store data in a database that has been calculated from other columns.

When displaying the information you would calculate it at that point. The usual exception to this is a data warehouse, where you would store pre-aggregated data etc for reporting performance reasons.

But for an application database I wouldn't store calculated columns.