Format: application/sql
⬇ Download File (677 B)
   1  SELECT 
   2      comp_source_store,
   3      comp_sku,
   4      base_source_store,
   5      base_sku,
   6      match,
   7      match_status
   8  FROM matches_{customer_name}_{customer_name}_{customer_name}
   9  WHERE customer_review_state IN ('customer_verified', 'manager_verified', 'both_customer_manager_verified')
  10    AND active = true
  11    AND match_status = 'product_found'
  12    AND company_code_base_source_store = '{customer_name}_{customer_name}_{customer_name}'
  13    AND deleted_date IS NULL
  14    and base_sku in 
  15    (
  16      select distinct sku from catalog_{customer_name}_{customer_name}_{customer_name}_{catalog_date}
  17      where 1=1
  18      and is_active = true
  19  or is_discontinued = false  
  20    )
  21    limit 100