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| joe@joe.com|32 joe1| joe1@joe.com|34 joe2| joe2@joe.com|35 joe3| joe3@joe.com|72 Age total for user = 144 / Quote 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 Quote 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. Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.