Try to change this: > "ORDER BY Year, ((Month - " & lngStartMth & ")*100 + (Day - " & lngStartDay > & ") + 1300) % 1300"
to this: > "ORDER BY Year, Month, Day" Pavel On Wed, Oct 14, 2009 at 8:08 PM, Rick Ratchford <r...@amazingaccuracy.com> wrote: > With Igor's help, I have this SQL statement that pulls out records based on > a start and stop date. > > "SELECT Year, Month, Day, Open, High, Low, Close FROM [" & gsTableName & "] > " & _ > "WHERE ((Month - " & lngStartMth & ")*100 + (Day - " & lngStartDay & ") + > 1300) % 1300 <= ((" & _ > lngEndMth - lngStartMth & ") * 100 + (" & lngEndDay - lngStartDay & ") + > 1300) % 1300 " & _ > "ORDER BY Year, ((Month - " & lngStartMth & ")*100 + (Day - " & lngStartDay > & ") + 1300) % 1300" > > It worked well, except I added the 'Year' to the ORDER BY so that I could > get the information in this format: > > (Example: 10/1 to 4/1) > > 1988 10 01 <data> > 1988 10 02 <data> > > ...crossing the end of the year... > ...into the next year... > > 1989 03 29 <data> > 1989 03 30 <data> > 1989 03 31 <data> > 1989 04 01 <data> > > ...starting the next 10/01 to 04/01 extraction... > > 1989 10 01 <data> > 1989 10 02 <data> > ... > ... > ...and so forth. > > > Problem is that by adding the 'Year' to ORDER BY, while it does in fact give > me the above format, it also includes info I don't need. For example, when > it started at 10/01 for 1988 and ended the year, it then continued to 04/01 > within the same 1988 year! > > Any suggestions? > > 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