Untitled

 avatar
unknown
sql
a year ago
2.2 kB
5
Indexable
select
    account.address as address
    , account.alternativename as alternative_name
    , createdbyid.name as created_by
    , account.createdon + interval '3 hour' as created_on
    , modifiedbyid.name as modified_by
    , account.modifiedon + interval '3 hour' as modified_on
    , account.name as name
    , owner.name as owner
    , account.parentid as parent_id
    , account.phone  as phone
    , primarycontact.name as primary_contact
    , smdocflowmethod.name as doc_flow_method
    , smdocflowoperator.name as doc_flow_operator
    , account.smemail as email
    , account.smexternalcode as external_code
    , account.sminn as inn
    , account.smisip as is_ip
    , account.smkpp as kpp
    , account.smmcc as mcc
    , account.smogrn_ogrnip as ogrn_ogrnip
    , account.smokved as okved
    , smaccountstatus.name as status
    , smaccountstatusspark.name as status_spark
    , smaccounttaxtype.name as tax_type
    , smaccountpromocodesorry.name as promocode_sorry
    , account.web as web
    , account.id as identificator
from vw_ods_bpm_soft.vw_account account
left join vw_ods_bpm_soft.vw_contact  createdbyid
    on createdbyid.id  = account.createdbyid
left join vw_ods_bpm_soft.vw_contact  modifiedbyid
    on modifiedbyid.id = account.modifiedbyid
left join vw_ods_bpm_soft.vw_contact  "owner"
    on "owner".id = account.ownerid
left join vw_ods_bpm_soft.vw_contact  primarycontact
    on primarycontact.id = account.primarycontactid
left join vw_ods_bpm_soft.vw_smaccountdocflowmethod smdocflowmethod
    on smdocflowmethod.id  = account.smdocflowmethodid
left join vw_ods_bpm_soft.vw_smdocflowoperator smdocflowoperator
    on smdocflowoperator.id = account."smdocflowoperatorid"
left join vw_ods_bpm_soft.vw_smaccountstatus smaccountstatus
    on smaccountstatus.id = account.smstatusid
left join vw_ods_bpm_soft.vw_smaccountstatusspark smaccountstatusspark
     on smaccountstatusspark.id = account.smstatussparkid
left join vw_ods_bpm_soft.vw_smaccounttaxtype smaccounttaxtype
    on smaccounttaxtype.id  = account.smtaxtypeid
left join vw_ods_bpm_soft.vw_smaccountpromocodesorry smaccountpromocodesorry
    on smaccountpromocodesorry.id  = account.smpromocodesorryid;
Editor is loading...
Leave a Comment