php - Add all lines multiplied by another line in another table -


I hope I can explain this quite well. I have 3 tables Wo_parts, workorders and part2vendor I am trying to get the cost of all the parts selling in a month. I have this script

  $ scoreCostQuery = "total_score as yoga (part2vendor.cost * wo_parts.qty) on selection part2vendor interiors (wo_parts.pn = part2vendor.pn) Where workorder = $ Join workorder wo_parts ";  

What I'm trying to do is in each part wo_parts (under PARTNUMBER [PN]). The cost of that item is in part2vendor (part number [pn] below) I need each part of the value in part2vendor will be multiplied by the quantity sold in wo_parts. The way all 3 tie-up is workorders.ident = wo_parts.workorder and part2vendor.pn = wo_parts.pn. I hope no one can help the above script give me the same total as when added to the calculator.

An answer

It is not, just a comment.

Why do not you take out the amount / multiplication operations outside the SQL statement? I know, it sounds stupid because it will increase the complexity of the code and the script, but always keep a good look at keeping the ISO code, and SQL statements as far as possible.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -