On Thu, 2009-07-09 at 10:47 +0200, Jean-Denis Muys wrote: > On 7/9/09 6:21 , "Rick Ratchford" <r...@amazingaccuracy.com> wrote: > > > > > Okay, this worked, but I have NO IDEA why. > > > > SQLString = "SELECT min(Year) FROM TmpTable " & _ > > "WHERE Month=1 UNION " & _ > > "SELECT max(Year) FROM TmpTable " & _ > > "WHERE Month = 12 LIMIT 2" > > > > > > While this returned the correct answers: > > > > 1988 > > 2008 > > > > <snip>
> <snip> > However, I'm afraid this query might not work in the general case. > > For example, if your data starts on january 20, 1988, then this query will > think 1988 is a full year. Ditto if the data ends early in december. > > So it seems to me that it works for you by luck, because your data set > doesn't start in january, nor ends in december. > SQLString = "SELECT min(Year) FROM TmpTable " & _ "WHERE Month=1 And Day<8 " & _ "UNION ALL " & _ "SELECT max(Year) FROM TmpTable " & _ "WHERE Month = 12 And Day>24 " This should limit it to looking for something in the first week and last week. David _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users