select R.FIRST_NAME + ' ' + R.LAST_NAME Donor, G.Amount, SA.FIRST_NAME + ' ' + SA.LAST_NAME Tribute, 
COALESCE(AR.first_Name + ' ' + AR.Last_Name, SA.FIRST_NAME + ' ' + SA.LAST_NAME) Acknowledgee, 
(case when TA.RELATIONSHIPS_ID IN
(select RELATIONSHIPS_ID from GIFT_TRIBUTE_ACKNOWLEDGEE 
where GIFT_TRIBUTE_ID = GT.ID and RELATIONSHIPS_ID is not null)
then 'Yes' 
when (select ID from GIFT_TRIBUTE_ACKNOWLEDGEE 
where GIFT_TRIBUTE_ID = GT.ID and GIFT_TRIBUTE_ACKNOWLEDGEE.SELFACKNOWLEDGE = -1 and COALESCE(GIFT_TRIBUTE_ACKNOWLEDGEE.RELATIONSHIPS_ID, -1) = COALESCE(TA.RELATIONSHIPS_ID, -1)) is not null
then 'Yes'
else 'No' end) Ack
 
from RECORDS R
inner join GIFT G on R.ID = G.CONSTIT_ID
inner join GIFT_TRIBUTE GT on GT.GIFT_ID = G.ID
left join TRIBUTE T on GT.TRIBUTE_ID = T.ID
left join RECORDS SA on SA.ID = T.RECORDS_ID
left join TRIBUTE_ACKNOWLEDGEE TA on TA.TRIBUTE_ID = T.ID
left join CONSTIT_RELATIONSHIPS CR on CR.ID = TA.RELATIONSHIPS_ID
left join RECORDS AR on AR.ID = CR.RELATION_ID
Disclaimer: Blackbaud provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Structured Query Language and the tools used to create and modify SQL statements and Crystal Reports. Blackbaud Customer Support may help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality.