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. 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 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. 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
Archived
This topic is now archived and is closed to further replies.