Greetings,
I am trying to organize contact emails based on very specific criteria and would appreciate some guidance. This info is coming from 3 tables and my requirements are:
The tables joins are simple but I'm not sure how to approach the grouping. A particular contact may have as many as 10 emails although I only want 3 of them
My Tables are structure as follows
Contact Emailindex Email
Contactid, fname, lname ContactId, Emailid, Default, Type EmailId, Email Address
1 John Doe 1 5 1 Home 5 john@gmail.com
2 Pete Smith 2 6 1 Work 6 pete@gmail.com
1 John Doe 1 7 0 Work 7 john@ibm.com
1 John Doe 1 8 0 Alternate 8 john@yahoo.com
1 John Doe 1 9 0 Hobby 9 john@verizon.com
2. If you are hoping for coding assistance, please provide sample DDL, along with sample data in the form of INSERT statements and desired results based on your sample data.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
February 22, 2021 at 5:00 am
I'm sorry I wasn't clear on what I was trying to do. Essentially, I was having issues trying to Group the data in the three tables shown so I could pull out as many as 3 emails/Client based on the requirements stated. I have come up with a workable solution several subqueries and ranking functions. Basically, I broke this up into 8 Groups and ran ranking functions on each Group based in the internal values of the Email Type fields. The values I wanted to key on had the largest values so it worked well with ranking functions. It isn't the most elegant solution but I can package it into a SP and it seems to produce the desired results.
February 22, 2021 at 11:01 am
Your solution sounds more complicated than it needs to be, but well done on working out something usable.
May I suggest that in future you do as I suggested and provide sample DDL, data and desired results. There are lots of talented people here and maybe you'd have obtained a better solution than what you have now.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply