Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select
- prd.id,
- prd.brand_name,
- prd.cat_no,
- prd.en_name,
- prd.cn_name,
- prd.cas,
- array_agg(distinct dg_kw.catalog) catalog_array,
- array_agg(distinct dg_kw.id) catalog_id
- FROM t_product prd
- INNER JOIN t_prod_danger dg_kw
- ON dg_kw.cas = prd.cas
- or (dg_kw.match_type = 'fuzzy' and prd.cn_name like '%' || dg_kw.cn_name || '%')
- or (dg_kw.match_type = 'fuzzy' and prd.cn_name like '%' || dg_kw.name_as || '%')
- or (dg_kw.match_type = 'exatct' and dg_kw.name_as = prd.cn_name)
- where 1=1
- -- and prd.brand_name in ('cato')
- and prd.is_delete = 1
- GROUP BY prd.id, prd.brand_name, prd.cat_no, prd.en_name, prd.cn_name, prd.cas
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement