Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --select * from cmn_finder where code = 'receipt.medicine.form.dozage'
- select distinct id, dosagepacking
- from ( select distinct (bd.dosage_packing || ' №' || substr(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name) , strpos(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name), '№') +1 ))
- as dosagepacking , min(bd.id) as id
- from md_benefit_detalization bd
- join md_benefit_inn bi on bd.inn_id = bi.id
- left join md_benefit_holding mbh on mbh.id = bd.holding_id
- LEFT JOIN supp.tas_000000272035_7vzn vzn on vzn.inn_name = bi.rus_name
- LEFT JOIN supp.tas_000000272035_new_reg new_reg on new_reg.inn_name = bi.rus_name
- LEFT JOIN supp.tas_000000272035_onls onls on onls.inn_name = bi.rus_name
- where ( (bd.inn_id = null or bd.holding_id =
- 48481
- --49352
- )
- and upper(bd.dosage_packing) like '%'||upper('')||'%')
- GROUP BY bd.dosage_packing || ' №' || substr(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name) , strpos(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name), '№') +1 )) a
- select distinct (bd.dosage_packing )
- as dosagepacking , min(bd.id) as id
- from md_benefit_detalization bd
- join md_benefit_inn bi on bd.inn_id = bi.id
- left join md_benefit_holding mbh on mbh.id = bd.holding_id
- LEFT JOIN supp.tas_000000272035_7vzn vzn on vzn.inn_name = bi.rus_name
- LEFT JOIN supp.tas_000000272035_new_reg new_reg on new_reg.inn_name = bi.rus_name
- LEFT JOIN supp.tas_000000272035_onls onls on onls.inn_name = bi.rus_name
- where ( (bd.inn_id = null or bd.holding_id =
- 48481
- --49352
- )
- and upper(bd.dosage_packing) like '%'||upper('')||'%')
- GROUP BY bd.dosage_packing
- -- || ' №' || substr(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name) , strpos(COALESCE(vzn.holding_name, new_reg.holding_name , onls.holding_name, mbh.rus_name), '№') +1 )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement