Fixed units shipped query
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
SELECT
|
||||
SELECT
|
||||
CASE WHEN item_number IN ('16688','25020') THEN 'XR Series'
|
||||
WHEN item_number IN ('22351','24952') THEN 'SL Series'
|
||||
WHEN item_number IN ('17861','25021','29243','29752') THEN 'TS Series'
|
||||
@@ -8,24 +8,24 @@ WHEN item_number IN ('17873') THEN 'Harmonic Neutralizer'
|
||||
|
||||
ELSE 'None'
|
||||
END AS "Product",
|
||||
reportpower.charass_value as "Power Output", reportinput.charass_value || ' ' || reportphases.charass_value AS "Input", ROUND(SUM(coitem_qtyord),0) as "Qty Ordered"
|
||||
reportpower.charass_value as "Power Output", reportinput.charass_value || ' ' || reportphases.charass_value AS "Input", ROUND(SUM(coitem_qtyshipped),0) as "Qty Shipped"
|
||||
FROM coitem LEFT OUTER JOIN cohead ON cohead_id=coitem_cohead_id
|
||||
LEFT OUTER JOIN itemsite ON coitem_itemsite_id = itemsite_id
|
||||
LEFT OUTER JOIN item ON item_id = itemsite_item_id
|
||||
LEFT OUTER JOIN charass AS reportpower ON
|
||||
(coitem_id = reportpower.charass_target_id
|
||||
AND reportpower.charass_target_type = 'SI'
|
||||
AND reportpower.charass_char_id = 25)
|
||||
LEFT OUTER JOIN charass AS reportinput ON
|
||||
(coitem_id = reportinput.charass_target_id
|
||||
AND reportinput.charass_target_type = 'SI'
|
||||
AND reportinput.charass_char_id = 36)
|
||||
LEFT OUTER JOIN charass AS reportphases ON
|
||||
(coitem_id = reportphases.charass_target_id
|
||||
AND reportphases.charass_target_type = 'SI'
|
||||
AND reportphases.charass_char_id = 18)
|
||||
LEFT OUTER JOIN charass AS reportpower ON
|
||||
(coitem_id = reportpower.charass_target_id
|
||||
AND reportpower.charass_target_type = 'SI'
|
||||
AND reportpower.charass_char_id = 25)
|
||||
LEFT OUTER JOIN charass AS reportinput ON
|
||||
(coitem_id = reportinput.charass_target_id
|
||||
AND reportinput.charass_target_type = 'SI'
|
||||
AND reportinput.charass_char_id = 36)
|
||||
LEFT OUTER JOIN charass AS reportphases ON
|
||||
(coitem_id = reportphases.charass_target_id
|
||||
AND reportphases.charass_target_type = 'SI'
|
||||
AND reportphases.charass_char_id = 18)
|
||||
WHERE item_number IN ('16688','17861','17862','17863','22351','25020','25144','25147','25021','24952','17873','29243','29752')
|
||||
AND (coitem_status <> 'X')
|
||||
AND (coitem_status <> 'X')
|
||||
AND cohead_id NOT IN(SELECT cohead_id from rahead LEFT OUTER JOIN cohead ON rahead_new_cohead_id=cohead_id WHERE cohead_id IS NOT NULL)
|
||||
AND coitem_price != 0
|
||||
AND (
|
||||
@@ -37,4 +37,4 @@ AND (
|
||||
)
|
||||
AND reportpower.charass_value IS NOT NULL
|
||||
GROUP BY reportpower.charass_value, "Product", "Input"
|
||||
ORDER BY "Product", reportpower.charass_value
|
||||
ORDER BY "Product", reportpower.charass_value
|
||||
|
||||
Reference in New Issue
Block a user