Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
3.4 kB
1
Indexable
Never
select
    opportunity.id identificator,
    opportunity.title  title, 
    opportunity.createdon  + interval '3 hours' created_on,
    createdby.name as created_by,
    opportunity.modifiedon  + interval '3 hours' as modified_on,
    modifiedby.name as modified_by,
    type.name as type,
    stage.name as stage,
    owner.name as owner,
    opportunity.notes  as notes,
    opportunity.accountid as account_identificator,
    category.name as category,
    contact.name as contact,
    opportunity.description as description,
    opportunity.smexternalcode as sm_external_code,
    opportunity.partnerid as sm_parent_id,
    contract.number as contract_number,
    opportunity.smleadfirstid as first_lead_id,
    segment.name as segment,
    opportunity.smbrandid as brand_identificator,
    opportunity.smintegrationchat as integration_chat,
    opportunity.smcontenttask as content_task,
    opportunity.smisdeliveryarealoaded as delivery_area_loaded,
    opportunity.smlinkadmin as link_admin,
    opportunity.smiscontentintegrationcomplete as content_integration_complete,
    opportunity.smisinstalledphoto as installed_photo,
    opportunity.smduplicatebynameid as duplicated_by_name_id,
    --content_status."Name" as content_status,
    loss_reason.name as loss_reason,
    opportunity.smlosscomment as loss_comment,
    opportunity.smispartnerloadsmenu as partner_loads_menu,
    opportunity.smisintegration as is_integration,
    opportunity.smchatphotoshoot as chat_photoshoot,
    opportunity.smlinkfoodphoto as link_food_photo,
    opportunity.smlinkfoodtable as link_food_table,
    opportunity.smlinkphoto as link_photo,
    opportunity.smaddconnectionrest as add_conection_rest,
    opportunity.smphotoshootrequired as photoshoot_required,
    vertical.name as vertical,
    connection_status.name as connection_status,
    opportunity.smisshowcaseready as is_showcase_ready
from vw_ods_bpm_soft.vw_opportunity opportunity
    left join vw_ods_bpm_soft.vw_contact createdby
        on createdby.id = opportunity.createdbyid  
    left join vw_ods_bpm_soft.vw_contact modifiedby
        on modifiedby.id = opportunity.modifiedbyid  
    left join vw_ods_bpm_soft.vw_opportunitytype type
        on type.id = opportunity.typeid  
    left join vw_ods_bpm_soft.vw_opportunitystage stage
        on stage.id = opportunity.stageid 
    left join vw_ods_bpm_soft.vw_contact owner
        on owner.id = opportunity.ownerid  
    left join vw_ods_bpm_soft.vw_smopportunitycategory category
        on category.id = opportunity.categoryid  
    left join vw_ods_bpm_soft.vw_contact contact
        on contact.id = opportunity.contactid 
    left join vw_ods_bpm_soft.vw_contract contract
        on contract.id = opportunity.contactid 
    left join vw_ods_bpm_soft.vw_smsegment segment
        on segment.id = opportunity.smsegmentid 
    --left join vw_ods_bpm_soft.vw_smopportunitycontentstatus content_status
    --    on content_status.id = opportunity."SmRecommendationStatusId"  
    left join vw_ods_bpm_soft.vw_smopportunitylossreason loss_reason
        on loss_reason.id = opportunity.smlossreasonid
    left join vw_ods_bpm_soft.vw_smopportunityvertical vertical
        on vertical.id = opportunity.smverticalid  
    left join vw_ods_bpm_soft.vw_smconnectionstatus connection_status
        on connection_status.id = opportunity.smopportunityconnectionstatusid;
Leave a Comment