Advertisement
Pandaaaa906

Untitled

Jul 26th, 2022
1,437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. count(distinct cd.id) filter(where prd.id is not null) prd_match,
  3. count(distinct cd.id) total
  4.  
  5. FROM "compound_detail" cd
  6.  
  7. LEFT JOIN chemhost.product prd
  8. ON prd.cas = cd.cas
  9.  
  10. WHERE cd.cas is not null;
  11.  
  12.  
  13. SELECT
  14. count(distinct prd.id) filter(where cd.id is not null) chem_match,
  15. count(distinct prd.id) filter(where prd.cas is not null and prd.cas != '' and prd.cas !~ '[nN]/?[Aa]') total_have_cas,
  16. count(distinct prd.id) total
  17.  
  18. FROM chemhost.product prd
  19.  
  20. LEFT JOIN "compound_detail" cd
  21. ON prd.cas = cd.cas;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement