jcrensha627 Posted March 1, 2009 Share Posted March 1, 2009 Im trying to figure out how to add rows together to get "volume" here an example of my table id symbol shares volume price 13 JAME 100 100 50.00 14 JAME 50 "X" 50.00 what SQL query do i use to make the "x" in id 14 equal to the volume in 13 + shares in 14. basically how do i have "X" replaced with 150 Quote Link to comment https://forums.phpfreaks.com/topic/147390-php-sql-help-adding-rows-together/ Share on other sites More sharing options...
sasa Posted March 1, 2009 Share Posted March 1, 2009 UPDATE table_name a, table_name b SET b.volume = a.volume + b. shares WHERE a.id='13' AND b.id='14' Quote Link to comment https://forums.phpfreaks.com/topic/147390-php-sql-help-adding-rows-together/#findComment-773635 Share on other sites More sharing options...
jcrensha627 Posted March 1, 2009 Author Share Posted March 1, 2009 Thanks SASA, do you know how i can have this work all id's not just specific ones. Quote Link to comment https://forums.phpfreaks.com/topic/147390-php-sql-help-adding-rows-together/#findComment-773668 Share on other sites More sharing options...
RussellReal Posted March 1, 2009 Share Posted March 1, 2009 remove the wheres lol Quote Link to comment https://forums.phpfreaks.com/topic/147390-php-sql-help-adding-rows-together/#findComment-773679 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.