dzingai Posted April 19, 2007 Share Posted April 19, 2007 I am building a simple income and expenditure app for myself, with seperate tables for income and expenditure. The income table looks like the following: id INT AUTO_INCREMENT PRIMARY KEY, date DATE, income1 INT(10) NULL, icome2 INT(10) NULL, income3 INT(10) NULL, income4 INT(10) NULL, etc What has stumped me is how to extract all the entries and get totals of each field? I want to be able to extract and view totals for each field (eg total_for_field1, total_for_field2, etc) and then add them all to give me the total for all. One option I had was to automatically increment the current amount with the new entry, but I would like to be able to later trace each entry. Link to comment https://forums.phpfreaks.com/topic/47728-need-help-how-do-i-get-totals-from-a-field/ Share on other sites More sharing options...
AndyB Posted April 19, 2007 Share Posted April 19, 2007 SUM() - simple tutorial http://www.tizag.com/mysqlTutorial/mysqlsum.php Link to comment https://forums.phpfreaks.com/topic/47728-need-help-how-do-i-get-totals-from-a-field/#findComment-233086 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.