> How do you properly do a Date comparison in SELECT so that the only rows > returned are those that do not exceed the date found in my sDateTemp > variable?
As a simple string comparison. You made it perfectly right except that your Date field should be stored in a format 'yyyy-mm-dd' in database. Without it comparison will not work. Pavel On Mon, Aug 3, 2009 at 2:19 PM, Rick Ratchford<r...@amazingaccuracy.com> wrote: > This works: > > SQLString = "SELECT Format$(Date, 'yyyy-mm-dd') as Date, Year, Month, > Day, Open, High, Low, Close, DayNum, 0 as IsSwingTop1, 0 as > IsSwingBtm1, 0 as IsSwingTop2, 0 as IsSwingBtm2, Null as Delta1, Null > as Delta2, 0 as Offset1, 0 as Offset2 FROM [" & sTable & "] GROUP BY > Year, Month, Day" > > > This does not: > > SQLString = "SELECT Format$(Date, 'yyyy-mm-dd') as Date, Year, Month, > Day, Open, High, Low, Close, DayNum, 0 as IsSwingTop1, 0 as > IsSwingBtm1, 0 as IsSwingTop2, 0 as IsSwingBtm2, Null as Delta1, Null > as Delta2, 0 as Offset1, 0 as Offset2 FROM [" & sTable & "] WHERE Date > < " & sDateTemp & " GROUP BY Year, Month, Day" > > The difference is that I want the second statement to only retrieve > records (rows) that do not exceed the date listed in sDateTemp. > > I've converted the local date format to "yyyy-mm-dd" in sDateTemp > before using it in this SQL statement. But that didn't seem to solve > the problem. I'm still getting a single blank record. > > How do you properly do a Date comparison in SELECT so that the only rows > returned are those that do not exceed the date found in my sDateTemp > variable? > > Thanks. > Rick > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users