Untitled

 avatar
unknown
sql
a year ago
2.1 kB
6
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 mail 
    , 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 "Account" account
left join "Contact" createdbyid
    on createdbyid."Id"  = account."CreatedById" 
left join "Contact" modifiedbyid
    on modifiedbyid."Id" = account."ModifiedById" 
left join "Contact" "owner"
    on "owner"."Id"  = account."OwnerId" 
left join "Contact" primarycontact
    on primarycontact."Id" = account."PrimaryContactId" 
left join "SmAccountDocFlowMethod" smdocflowmethod
    on smdocflowmethod."Id"  = account."SmDocFlowMethodId" 
left join "SmDocFlowOperator" smdocflowoperator
    on smdocflowoperator."Id" = account."SmDocFlowOperatorId" 
left join "SmAccountStatus" smaccountstatus
    on smaccountstatus."Id" = account."SmStatusId"
left join "SmAccountStatusSPARK" smaccountstatusspark
     on smaccountstatusspark."Id" = account."SmStatusSparkId" 
left join "SmAccountTaxType" smaccounttaxtype 
    on smaccounttaxtype."Id"  = account."SmTaxTypeId" 
left join "SmAccountPromocodeSorry" smaccountpromocodesorry
    on smaccountpromocodesorry."Id"  = account."SmPromocodeSorryId";
Editor is loading...
Leave a Comment