Hi all,
This question is sort of related to a previous post of mine about querying dates. I'm trying to use a cfif statement in my where clause to determine if a field is empty or not. Here's the code:
<cfquery name="GetPastEvents" datasource="DSN">
SELECT *
FROM SITE:Calendar
WHERE DatePart('yyyy', [StartDate]) = <cfqueryparam value="#Dateformat(Today, 'yyyy')#" cfsqltype="CF_SQL_DATE" />
and <cfif EndDate neq ''>StartDate<cfelse>EndDate</cfif>< <cfqueryparam value="#Today#" cfsqltype="CF_SQL_DATE" />
and Archive = <cfqueryparam value="0" cfsqltype="CF_SQL_INTEGER" />
ORDER BY StartDate ASC, StartTime ASC
</cfquery>
My issue that that CF tells me EndDate is not defined. EndDate is a field in the table SITE:Calendar. There has to be a way to make this work, no? Thanks!