Untitled

mail@pastecode.io avatar
unknown
sql
a month ago
1.4 kB
3
Indexable
Never
select 
b."CreatedOn" + interval '3 hours' created_on,
createdby."Name" as created_by,
b."ModifiedOn" + interval '3 hours' as modified_on,
modifiedby."Name" as modified_by,
b."SmExternalCode" as external_code,
b."SmExternalId" as external_id,
sh."SmName" as holding_name,
sbit."Name" as integration_type,
b."SmName" as name,
b."SmRestarauntCnt" as rest_count,
ss."Name" as segment,
sbs."Name" as status,
sbt."Name" as tier,
b."Id" as identificator,
owner."Name" as owner,
b."SmNumberRestaurants" as number_restaurants,
sbcit."Name" as content_integration_type,
b."SmNotes" as notes,
oc."Name" as category,
sov."Name" 
from "SmBrand" b 
left join "Contact" createdby
    on createdby."Id" = b."CreatedById"  
left join "Contact" modifiedby
    on modifiedby."Id" = b."ModifiedById"
left join "SmHolding" sh 
	on sh."Id" = b."SmHoldingId" 
left join "SmBrandIntegrationType" sbit 
	on sbit."Id" = b."SmIntergrationTypeId" 
left join "SmSegment" ss 
	on ss."Id" = b."SmSegmentId" 
left join "SmBrandStatus" sbs 
	on sbs."Id" = b."SmStatusId" 
left join "SmBrandTier" sbt 
	on sbt."Id" = b."SmTierId" 
left join "Contact" owner
    on owner."Id" = b."SmOwnerId"  
left join "SmBrandContentIntegrationType" sbcit 
	on sbcit."Id" = b."SmContentIntegrationTypeId" 
left join "OpportunityCategory" oc 
	on oc."Id" = b."SmCategoryId"
left join "SmOpportunityVertical" sov 
	on sov."Id" = b."SmVerticalId"
Leave a Comment