Untitled

 avatar
unknown
sql
a year ago
1.9 kB
2
Indexable
select
a."BlindCopyRecepient" blind_copy_recepient,
a."Body" as body,
a."CopyRecepient" as copy_recepient,
ess."Name" as email_send_status,
a."ErrorOnSend" as error_on_send,
a."IsHtmlBody" as is_html_body,
et."Name" as message_type,
a."Recepient" as recepient,
a."SendDate" as send_date,
a."Sender" as sender,
c."Id" as sender_contact,
a."AccountId" as account_identificator,
ac."Name" as activity_category,
a."ActivityConnectionId" as activity_connection,
c2."Name" as contact,
createdbyid."Name" as created_by,
a."CreatedOn" + interval '3 hour' as created_on_dttm,
modifiedbyid."Name" as modified_by,
a."ModifiedOn" + interval '3 hour' as modified_on_dttm,
a."DetailedResult" as detailed_results,
a."DueDate" as due_date,
a."SmLeadId" as lead_identificator,
a."OpportunityId" as opportunity_identificator,
owner."Name" as owner,
ap."Name" as priority,
ar."Name" as result,
a."SmDueDatePlan" as due_date_plan,
a."SmRestaurantId" as restaurant_identificator,
a."StartDate" as start_date,
as2."Name" as status,
a."Title" as title,
at2."Name" as type,
a."Id" as identificator,
a."SmBrandId" as brand_identificator
from "Activity" a 
left join "EmailSendStatus" ess 
	on a."EmailSendStatusId" = ess."Id" 
left join "EmailType" et 
	on a."MessageTypeId" = et."Id" 
left join "Contact" c 
	on a."SenderContactId" = c."Id"  
left join "ActivityCategory" ac 
	on a."ActivityCategoryId" = ac."Id" 
left join "Contact" c2
	on a."ContactId" = c2."Id" 
left join "Contact" createdbyid
    on createdbyid."Id"  = a."CreatedById" 
left join "Contact" modifiedbyid
    on modifiedbyid."Id" = a."ModifiedById" 
left join "Contact" owner
    on owner."Id" = a."OwnerId" 
left join "ActivityPriority" ap 
	on a."PriorityId" = ap."Id" 
left join "ActivityResult" ar 
	on a."ResultId" = ar."Id" 
left join "ActivityStatus" as2 
	on a."StatusId" = as2."Id" 
left join "ActivityType" at2 
	on a."TypeId" = at2."Id" 
Editor is loading...
Leave a Comment