sourcecoder Posted November 18, 2010 Share Posted November 18, 2010 Hi again I have a db that has coulm : name,email, age And now i want to calculate the age for my users.. just like row 2 + row 3+row4+row5 = See what i mean? joe| [email protected]|32 joe1| [email protected]|34 joe2| [email protected]|35 joe3| [email protected]|72 Age total for user = 144 / Link to comment https://forums.phpfreaks.com/topic/219097-count-numbers-in-mysql-row/ Share on other sites More sharing options...
Pikachu2000 Posted November 18, 2010 Share Posted November 18, 2010 You mean for all users at once? SELECT SUM(age) FROM table Link to comment https://forums.phpfreaks.com/topic/219097-count-numbers-in-mysql-row/#findComment-1136150 Share on other sites More sharing options...
PFMaBiSmAd Posted November 18, 2010 Share Posted November 18, 2010 Unless a person is dead, their age is not a fixed value (changes once a year for most people.) I recommend storing the date of birth in your table and calculating the age when necessary. Link to comment https://forums.phpfreaks.com/topic/219097-count-numbers-in-mysql-row/#findComment-1136155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.