Advertisement
Pandaaaa906

Untitled

Dec 23rd, 2022
1,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. select
  2. prd.id,
  3. prd.brand_name,
  4. prd.cat_no,
  5. prd.en_name,
  6. prd.cn_name,
  7. prd.cas,
  8. array_agg(distinct dg_kw.catalog) catalog_array,
  9. array_agg(distinct dg_kw.id) catalog_id
  10.  
  11.  
  12. FROM t_product prd
  13.  
  14. INNER JOIN t_prod_danger dg_kw
  15. ON dg_kw.cas = prd.cas
  16. or (dg_kw.match_type = 'fuzzy' and prd.cn_name like '%' || dg_kw.cn_name || '%')
  17. or (dg_kw.match_type = 'fuzzy' and prd.cn_name like '%' || dg_kw.name_as || '%')
  18. or (dg_kw.match_type = 'exatct' and dg_kw.name_as = prd.cn_name)
  19.  
  20. where 1=1
  21. -- and prd.brand_name in ('cato')
  22. and prd.is_delete = 1
  23.  
  24. GROUP BY prd.id, prd.brand_name, prd.cat_no, prd.en_name, prd.cn_name, prd.cas
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement