Untitled

mail@pastecode.io avatar
unknown
sql
a month ago
1.5 kB
2
Indexable
Never
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 vw_ods_bpm_soft.vw_contract c
left join vw_ods_bpm_soft.vw_contact created_by
    on created_by.id = c.createdbyid
left join vw_ods_bpm_soft.vw_contact modified_by
    on modified_by.id = c.modifiedbyid
left join vw_ods_bpm_soft.vw_contractstate cs
    on cs.id = c.stateid
left join vw_ods_bpm_soft.vw_contracttype ct
    on ct.id = c.typeid;
Leave a Comment