Querying the Right Title per Corresponding Year
Hi,
I'm having trouble figuring the logic on how I can output this information.
Basically, I'm querying a yearly report from my database where some donors post as "Anonymous" per year. Problem is, once they give "Anonymously" at any given year, their name stops showing up, and appears as "Anonymous" for the following years, including the previous years as well.
The list should only list "Anonymous" for the current year that it is pulling the information from, if they have given anonymously for that year. Otherwise, it should just show their name.
I am not sure if I need to set the years as a loop and then set an "<cfif>/<cfelse>" statement. Any help would be appreciated.
This is my code where it outputs the information:
<td><cfif SalAnnRep_Ovr IS NOT "">#SalAnnRep_Ovr#<cfelse>#SalAnnRep#</cfif></td>
The data that I am pulling from my DB:
SELECT IDCon, Ca_First, Ca_Middle, Ca_Last, Ca_Suffix, isSchoolChampion, <cfif FYoffset LTE 5>FY#FYoffset#_CY AS CY<cfelse>0 AS CY</cfif>, SalAnnRep, SalAnnRep_Ovr
FROM Constituents
WHERE RecordType = 'Ind'
</cfquery>
I am also retrieving the year through roman numeral.
SELECT *
FROM romans
WHERE RomNum = <cfqueryparam cfsqltype="cf_sql_integer" value="#Form.AGC#">
ORDER BY RomNum DESC
</cfquery>
