Given the following table:
type | valueOfType
food | 4.3
food | 5.3
dairy | 3.2
food | 1.3
food | 6.7
==============
My query needs to search for all "food" type and add all the "valueOfType" where valueOfType is a float type. How can I do it?
edit:
$query = "SELECT SUM(valueOfType) AS Total FROM productTbl WHERE type ='$post_type' ";
$result = mysql_query($query2)
or die("Unable to execute query because : " . mysql_error());
echo $result;