Guest User

Untitled

a guest
Apr 6th, 2023
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. SELECT central_products.products.incremental,
  2. central_products.products.mfg_part_number,
  3. central_products.products.item_condition,
  4. central_products.products.description,
  5. COUNT(
  6. CASE
  7. WHEN Viixim.inventory.status = 'IN_STOCK' THEN 1
  8. END
  9. ) AS Viixim_stock,
  10. COUNT(
  11. CASE
  12. WHEN Evrymm.inventory.status = 'IN_STOCK' THEN 1
  13. END
  14. ) AS Evrymm_stock,
  15. IFNULL(AVG(Viixim.inventory.cost), 0) AS Viixim_cost,
  16. IFNULL(AVG(Evrymm.inventory.cost), 0) AS Evrymm_cost
  17. FROM central_products.products
  18. LEFT JOIN Viixim.inventory ON Viixim.inventory.product_code = central_products.products.incremental
  19. LEFT JOIN Evrymm.inventory ON Evrymm.inventory.product_code = central_products.products.incremental
  20. GROUP BY central_products.products.incremental
Advertisement
Add Comment
Please, Sign In to add comment