Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set search_path = _00000003, public;
- select
- t."@Телефон" "@phone",
- coalesce('8'||t."Код"||t."Номер", t."НомерПолный") "phone",
- t."Код" "code",
- t."Номер" "num",
- t."Балл" "ball",
- ('8'||t."Код"||t."Номер") IS NOT NULL "normal"
- from
- "КонтрагентТелефон" kt
- join "Телефон" t on kt."Телефон" = t."@Телефон"
- where
- "Контрагент" = 3067312 and
- kt."Действующий"
- union all
- select
- NULL "@phone",
- l."КонтактныеДанные",
- NULL "code",
- NULL "num",
- NULL "ball",
- false "normal"
- from
- "Лид" l
- where
- l."@Документ" = 76634300 and
- l."КонтактныеДанные" is not null
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement