vadimua757

Untitled

Sep 21st, 2021
896
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT COUNT(DISTINCT detail.id) as details_count
  2. FROM details detail
  3.          JOIN akeneo_detail ad on detail.id = ad.main_detail_id
  4.          JOIN akeneo_category ac on ad.category_id = ac.id
  5.  
  6.          LEFT JOIN detail_prices p ON detail.id = p.detail_id
  7.          LEFT JOIN remains r on detail.id = r.detail_id
  8.          LEFT JOIN detail_partner_prices pp ON detail.id = pp.detail_id
  9.          LEFT JOIN partner_remains pr on detail.id = pr.detail_id
  10. WHERE
  11.         detail.is_disabled = 0
  12.   AND ac.id = 24
  13.   AND r.storage_id NOT IN ('20', '21')
  14.   AND ((r.id IS NOT NULL AND p.detail_id IS NOT NULL)
  15.            OR (pr.id IS NOT NULL AND pp.detail_id IS NOT NULL))
  16. GROUP BY
  17.     ac.id
RAW Paste Data