shedokan Posted June 22, 2009 Share Posted June 22, 2009 I have a table like this: +----+------------+ | id | number | +----+------------+ | 1 | 15 | | 1 | 4 | | 2 | 29 | +----+------------+ is there any way to select all the rows that are with id 1 and add the up to 15+4=19? Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/163299-solved-add-up-all-values/ Share on other sites More sharing options...
J.Daniels Posted June 22, 2009 Share Posted June 22, 2009 SELECT SUM(number) as sum FROM table WHERE id=1 Quote Link to comment https://forums.phpfreaks.com/topic/163299-solved-add-up-all-values/#findComment-861535 Share on other sites More sharing options...
shedokan Posted June 22, 2009 Author Share Posted June 22, 2009 Ow right, thanks. forgot about sum. Quote Link to comment https://forums.phpfreaks.com/topic/163299-solved-add-up-all-values/#findComment-861553 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.