AccountID ContactName ContactCity ReachByPhone LastContactDate DecisionType
001234xx Sean Chicago Yes 03/22/2008 TDM
001234xx Micheal Tustin Yes 12/10/2011 Technical
001234xx Ravi Costa Mesa No 05/25/2012 Business
001234xx Naveeth Los Angeles Yes 07/02/2013 TDM
113452yy Linn San Diego Yes 09/10/2013 BDM
228643cc Ganesh Wilshire Yes 10/09/2013 NULL
Hi All, I need to write a query to retrieve data from above table but I am little bit confuse. In my table one account may have multiple contacts due to different locations. so I would like to get only one contact per one account and my conditions are ReachbyPhone should be Yes, we had to be contacted with that corresponding company within last 3 years, if it is more than 3 years ago I won't count it (like first record in my table) and DecisionType should be TDM, if there is no than Technical, if there is no then BDM, ,if there is no then Business. I hope my explanation is clear enough. If someone has idea I will wait for inputs.
Thanks