samona Posted May 26, 2011 Share Posted May 26, 2011 Anyone have an idea of how to sum a calculated field. I have field A and field B. I create a new field called C and that equals the sum(A, B). Now i want a grand total of field C. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/237531-sum-calculated-field/ Share on other sites More sharing options...
Maq Posted May 26, 2011 Share Posted May 26, 2011 Please refer to the documentation next time: SELECT SUM(A + B) AS total FROM table_name; Quote Link to comment https://forums.phpfreaks.com/topic/237531-sum-calculated-field/#findComment-1220624 Share on other sites More sharing options...
samona Posted May 26, 2011 Author Share Posted May 26, 2011 Thx! Where in the Doc? Quote Link to comment https://forums.phpfreaks.com/topic/237531-sum-calculated-field/#findComment-1220631 Share on other sites More sharing options...
Maq Posted May 26, 2011 Share Posted May 26, 2011 thanks! Where in the Doc? http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_sum (There are also specific examples in the comments below) Quote Link to comment https://forums.phpfreaks.com/topic/237531-sum-calculated-field/#findComment-1220633 Share on other sites More sharing options...
samona Posted May 26, 2011 Author Share Posted May 26, 2011 Bookmarked it. Thx again! Quote Link to comment https://forums.phpfreaks.com/topic/237531-sum-calculated-field/#findComment-1220640 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.