Tried that. It doesn't work. For example, when I used 09/01 as my start and 04/01 as my ending, what I got back was:
1988 1 4 1988 1 5 1988 1 6 ... ... Instead of: 1988 9 1 1988 9 2 ... ... 1989 3 30 1989 3 31 1989 4 1 1989 9 1 1989 9 2 ... ... 1990 3 31 1990 4 1 ... ... Etc. Thanks for the suggestion. :) Rick #>-----Original Message----- #>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users- #>boun...@sqlite.org] On Behalf Of Pavel Ivanov #>Sent: Wednesday, October 14, 2009 7:45 PM #>To: General Discussion of SQLite Database #>Subject: Re: [sqlite] Tackling the Date Scan SQL #> #>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 _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users