I was writing a mySQL query that only included dates in the results after today, and thought I’d share a quick problem I ran into.
SELECT column1, column2 FROM table WHERE columnDate >= NOW()
Unfortunately, the NOW() function in mySQL will not include today. Of course if I wanted to exclude today I’d take off the =. I’m sure there’s a way to fidget with it and get it to do what I want in mySQL, but with a simple ColdFusion function I was able to get the result I was looking for.
SELECT column1, column2 FROM table WHERE columnDate >= <cfqueryparam value="#CreateODBCDate(now())#" cfsqltype="cf_sql_date" />