Untitled

 avatar
unknown
sql
a year ago
2.6 kB
5
Indexable
select 
created_by."Name" as created_by,
sl."SmNotes" as notes,
sl."CreatedOn" as created_on,
modified_by."Name" as modified_by,
sl."ModifiedOn" as modified_on,
sl."SmAccountId" as account_identificator,
sl."SmAccountINN" as inn,
slcr."Name" as clode_results,
contact."Name" as contact,
sl."SmContactEmail" as email,
sl."SmContactFIO" as fio,
sl."SmContactPhone" as phone,
sdfo."Name" as doc_flow_operator,
sl."SmIntegrationInfoBilling" as intergration_info_billing,
sl."SmIntegrationInfoLegium" as intergration_info_legium,
sl."SmIntegrationInfoLending" as intergration_info_lending,
sl."SmIntegrationInfoSpark" as intergration_info_spark,
sl."SmName" as name,
sl."SmOpportunityId" as opportunity_identificator,
slo."Name" as lead_origin,
owner."Name" as owner,
sl."SmRestaurantId" as restaurant_identificator,
sl."SmRestaurantAddress" as restaurant_address,
sl."SmRestaurantCnt" as restaurant_cnt,
sl."SmRestaurantName" as restaurant_name,
slr."Name" as reward,
sl."SmSignDate" as sign_date,
sl."SmSignLink" as sign_link,
cs."Name" as sign_status,
sls."Name" as source,
sls2."Name" as stage,
sl."SmUTMCampaign" as utm_campaign,
sl."SmUTMContent" as utm_content,
sl."SmUTMMedium" as utm_medium,
sl."SmUTMSource" as utm_source,
sl."SmUTMTerm" as utm_term,
sl."SmUTMManager" as utm_manager,
referrer."Name" as referrer,
sl."SmIsRewardSent" as reward_sent,
slrs."Name" as recommendation_status,
sl."SmIsVerified" as verified,
sl."Id" as identificator,
oc."Name" as category,
sov."Name" as vertical
from "SmLead" sl 
left join "Contact" created_by
    on created_by."Id" = sl."CreatedById"
left join "Contact" modified_by
    on modified_by."Id" = sl."ModifiedById"  
left join "SmLeadCloseResult" slcr 
	on slcr."Id" = sl."SmCloseResultId" 
left join "Contact" contact
	on contact."Id" = sl."SmContactId"
left join "SmDocFlowOperator" sdfo 
	on sdfo."Id" = sl."SmDocFlowOperatorId" 
left join "SmLeadOrigin" slo 
	on slo."Id" = sl."SmOriginId" 
left join "Contact" owner
	on owner."Id" = sl."SmOwnerId" 
left join "SmLeadReward" slr 
	on slr."Id" = sl."SmRewardId" 
left join "ContractState" cs 
	on cs."Id" = sl."SmSignStatusId" 
left join "SmLeadSource" sls 
	on sls."Id" = sl."SmSourceId" 
left join "SmLeadStage" sls2 
	on sls2."Id" = sl."SmStageId" 
left join "Contact" referrer
	on referrer."Id" = sl."SmReferrerId" 
left join "SmLeadRecommendationStatus" slrs 
	on slrs."Id" = sl."SmRecommendationStatusId" 
left join "OpportunityCategory" oc 
	on oc."Id" = sl."SmCategoryId" 
left join "SmOpportunityVertical" sov 
	on sov."Id" = sl."SmVerticalId" 
Editor is loading...
Leave a Comment