Answered by:
Linking Tables together

Question
-
I want to create a report that show Contact and their Activities (both open and closed) and Marketing Lists.
I am having a problem determing which tables (Activities, Marketing List) these are and the fields that link them all together.
Is there no document that show the tables and the fields they link on? The LogicalDBDiagram is close but not quite complete.
Thank youWednesday, April 1, 2009 1:46 PM
Answers
-
For Activities, check the ActivityParty - that will show who was attached to an email - (the contact may be attached multiple times/ways - as a sender/recepient/cc/bcc etc.) (you can extend this to pick up the other entity types you need to report on.
select distinct top 10 c.contactid, c.fullname, Party.ParticipationtypemaskName, Pointer.ActivityTypeCodeName, Email.Subject from FilteredContact c Left Join FilteredActivityParty Party on Party.PartyId = c.ContactId Join FilteredActivityPointer Pointer On Party.ActivityId = Pointer.ActivityId Left Join FilteredEmail Email on Email.ActivityId = Party.ActivityId
and for the Marketing lists - its the lists and listmembers you're looking for
select distinct top 10 c.contactid, c.fullname, List.ListName from FilteredContact c Left Outer Join FilteredListMember Member on Member.entityid = c.contactid Join FilteredList List On Member.ListId = List.ListId order by fullname
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Proposed as answer by Scott Sewell, Hitachi SolutionsModerator Wednesday, April 1, 2009 3:20 PM
- Marked as answer by Matthews_416 Wednesday, April 1, 2009 5:33 PM
Wednesday, April 1, 2009 3:20 PMModerator -
They're all in the same tables - just check state/status (status/statusreason)
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Marked as answer by Matthews_416 Thursday, April 2, 2009 11:44 AM
Wednesday, April 1, 2009 7:58 PMModerator
All replies
-
Hi,
You can download the diagram from here:
http://www.microsoft.com/downloads/details.aspx?FamilyID=b73912e8-861e-43ae-97b4-72b3e809f287&displaylang=en
MortenWednesday, April 1, 2009 2:48 PM -
For Activities, check the ActivityParty - that will show who was attached to an email - (the contact may be attached multiple times/ways - as a sender/recepient/cc/bcc etc.) (you can extend this to pick up the other entity types you need to report on.
select distinct top 10 c.contactid, c.fullname, Party.ParticipationtypemaskName, Pointer.ActivityTypeCodeName, Email.Subject from FilteredContact c Left Join FilteredActivityParty Party on Party.PartyId = c.ContactId Join FilteredActivityPointer Pointer On Party.ActivityId = Pointer.ActivityId Left Join FilteredEmail Email on Email.ActivityId = Party.ActivityId
and for the Marketing lists - its the lists and listmembers you're looking for
select distinct top 10 c.contactid, c.fullname, List.ListName from FilteredContact c Left Outer Join FilteredListMember Member on Member.entityid = c.contactid Join FilteredList List On Member.ListId = List.ListId order by fullname
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Proposed as answer by Scott Sewell, Hitachi SolutionsModerator Wednesday, April 1, 2009 3:20 PM
- Marked as answer by Matthews_416 Wednesday, April 1, 2009 5:33 PM
Wednesday, April 1, 2009 3:20 PMModerator -
I failed to mention, you'll want to adjust the join types (outer/not) to get the results you're needing for your report.
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewellWednesday, April 1, 2009 3:26 PMModerator -
Thanks for the information. I do have one more question however.
On the Activity, I will want to report on both the Open and Closed items.
Where are the Closed items, is that the History?
Thank youWednesday, April 1, 2009 7:56 PM -
They're all in the same tables - just check state/status (status/statusreason)
Scott Sewell, CustomerEffective | http:\\blog.CustomerEffective.com | Twitter:@ScottSewell- Marked as answer by Matthews_416 Thursday, April 2, 2009 11:44 AM
Wednesday, April 1, 2009 7:58 PMModerator