Fastest Web Hosting

how can i get sum of a column by sql

0 votes
asked Jul 6, 2016 in Mysql by rohit (2,750 points)

I have a table in mysql

supplier-volume
1             - 100
5             - 800
7             - 710
1             - 450
6             - 150

i want to a result total volume of specific supplier, please help me to do that..i am new in php programming , working in core php.

1 Answer

0 votes
answered Jul 6, 2016 by rajatinsa (3,350 points)
edited Sep 11, 2016 by admin

Use sum function of sql , in your case use sql query like

$sql = "select sum(volume) as total_volume from yourtable_name where supplier = 1"

1 is supplier id

Job Board

TechnicalSharp is a technical community of developers where they are sharing their knowledge and solutions and against it they are getting the score point which help them to make profile strong which is under eyes on MNC's
...