Mysql subquery for sum all columns in inner Join -


i attempting sum of 12 columns (in same table) in subquery in inner join. here link schema :

sqlfiddle

the query attempting use this:

select  `inventory`.`part_number`, `inventory`.`qty`, `inventory`.`description`, `reorder`.`reorder_point` * '1' `point`, `inventory`.`cost`, `vendor`.`name` `vendor_name`,    select (sum(`saleshistory`.`sales_1_month_prior`)+sum(`saleshistory`.`sales_2_month_prior`)+sum(`saleshistory`.`sales_3_month_prior`)+sum(`saleshistory`.`sales_4_month_prior`)+sum(`saleshistory`.`sales_5_month_prior`)+sum(`saleshistory`.`sales_6_month_prior`)+sum(`saleshistory`.`sales_7_month_prior`)+sum(`saleshistory`.`sales_8_month_prior`)+sum(`saleshistory`.`sales_9_month_prior`)+sum(`saleshistory`.`sales_10_month_prior`)+sum(`saleshistory`.`sales_11_month_prior`)+sum(`saleshistory`.`sales_12_month_prior`) ttl `inventory` left join `reorder` on `inventory`.`part_number` = `reorder`.`part_number` left join `vendor` on `inventory`.`vendor` = `vendor`.`vendor_id` inner join `saleshistory` on `saleshistory`.`location` =     `inventory`.`location` , `saleshistory`.`part_number` = `inventory`.`part_number` `inventory`.`qty` <= `reorder`.`reorder_point` , `inventory`.`location` = '99' , `reorder`.`reorder_point` != '0' group `inventory`.`part_number` order `vendor`.`name` asc 

when using query, returns values records not rows.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -