Posted to tcl by CecilWesterhof at Mon Jul 30 18:33:56 GMT 2018view pretty
I have the following code: set yesterdayAboveCountC { SELECT COUNT(*) , :tempAbove FROM temperature WHERE date = DATE('now', '-1 day') AND Temperature > :tempAbove } set yesterdayAboveCountD { SELECT COUNT(*) , :tempAbove FROM temperature WHERE date = DATE('now', '-1 day') AND Temperature > 65 } puts [db eval ${yesterdayAboveCountC}] puts ################ puts [db eval ${yesterdayAboveCountD}] And this gives: 0 65 ################ 817 65 So it looks like thet :tempAbove is incorrectly expanded in the WHERE clause in yesterdayAboveCountC. What could be the reason of this?
Comments
Posted by CecilWesterhof at Mon Jul 30 19:29:57 GMT 2018 [text] [code]
It needs a CAST: AND Temperature > CAST(:tempAbove AS real)