Untitled

 avatar
unknown
sql
a year ago
1.5 kB
7
Indexable
select 
c."AccountId" as account_identificator,
c."Notes" as notes,
created_by."Name" as created_by,
c."CreatedOn" + interval '3 hour' as created_on,
modified_by."Name" as modified_by,
c."ModifiedOn" + interval '3 hour' as modified_on,
c."Number" as number,
c."SmBrandId" as brand_identificator,
c."SmExternalCode" as external_code,
c."SmLinkSignedDoc" as link_signed_doc,
c."SmLinkSigning" as link_signing,
c."SmLinkLegal" as link_legal, 
c."StartDate" as start_date,
c."EndDate" as end_date,
c."SmAcceptDate" as accept_date,
c."SmAdditionalAgreement" as additional_agreement,
c."SmValueSbermarket" as value_sbermarket,
c."SmValueAfterEndSbermarket" value_after_end_sbermarket,
c."SmDurationSbermarket" as duration_sbermarket,
c."SmValueRestaurant" as value_restaurant,
c."SmValueAfterEndRestaurant" value_after_end_restaurant,
c."SmDurationRestaurant" as duration_restaurant,
c."SmValuePickup" as value_pickup,
c."SmValueAfterEndPickup" value_after_end_pickup,
c."SmDurationPickup" as duration_pickup,
c."SmIsTrial" as is_trial,
c."SmIsAgreementOld" as is_agreement_old,
cs."Name" as state,
ct."Name" as type,
c."Id" as identificator,
c."SmNumberExternal" as number_external,
c."SmParentOpportunityId" as parent_opportunity_identificator
from "Contract" c 
left join "Contact" created_by
    on created_by."Id" = c."CreatedById"
left join "Contact" modified_by
    on modified_by."Id" = c."ModifiedById" 
left join "ContractState" cs
    on cs."Id" = c."StateId" 
left join "ContractType" ct 
    on ct."Id" = c."TypeId" 
Editor is loading...
Leave a Comment