Below returns zero recordset from the stats table (when I know there are 100's):
Below returns all the proptype=4 regardless of the date:
This gives me a "Unknown column 'theDate' in 'where clause'" error:
How do I pass the yesterday data variable into MySQL?
Thanks,
Dave
Code:
<cfset today = createDate(year(now()), month(now()), day(now()))>
<cfset yesterday = dateAdd("d", -1, today)>
<cfquery name="GetAptsStats" datasource="#DSN#">
SELECT listingFk, listingId, timeStampStats
FROM stats INNER JOIN listing ON stats.listingFk = listing.listingId
WHERE proptype = 4
AND timeStampStats = #yesterday#
</cfquery>
Below returns all the proptype=4 regardless of the date:
Code:
<cfset today = CreateODBCDate(Now())>
<cfset yesterday = CreateODBCDate(DateAdd('d', -1, #today#))>
<cfquery name="GetAptsStats" datasource="#DSN#">
SELECT listingFk, listingId, timeStampStats
FROM stats INNER JOIN listing ON stats.listingFk = listing.listingId
WHERE proptype = 4
AND DATE(timeStampStats) = #yesterday#
</cfquery>
This gives me a "Unknown column 'theDate' in 'where clause'" error:
Code:
<cfset today = CreateODBCDate(Now())>
<cfset yesterday = CreateODBCDate(DateAdd('d', -1, #today#))>
<cfquery name="GetAptsStats" datasource="#DSN#">
SELECT listingFk, listingId, DATE(timeStampStats) AS theDate
FROM stats INNER JOIN listing ON stats.listingFk = listing.listingId
WHERE proptype = 4
AND theDate = #yesterday#
</cfquery>
How do I pass the yesterday data variable into MySQL?
Thanks,
Dave