I have a PHP page running in postgres. I have 3 tables - workorders, *wo_parts* and part2vendor. I am trying to multiply 2 table column row datas together, ie *wo_parts* has a field called qty and part2vendor has a field called cost. These 2 are joined by *wo_parts.pn* and part2vendor.pn. I have created a query like this:
$scoreCostQuery = "SELECT SUM(part2vendor.cost*wo_parts.qty) as total_score
FROM part2vendor
INNER JOIN wo_parts
ON (wo_parts.pn=part2vendor.pn)
WHERE workorder=$workorder";
But if I add the costs of the parts multiplied by the qauntities supplied, it adds to a different number than what the script is doing. Help....I am new to this but if someone can show me in SQL I can modify it for postgres. Thanks