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
> 
> What I don't understand is why it didn't simply return:
> 
> 1988
> 1988
> 
> Since there is at least 15 or more days in Month=1 (Jan).
> 
> Anyone?
> 

<Warning> Noobie here </Warning>

I think the min and max functions by design return only one value.

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.

Unless of course if I am totally wrong, which happens often enough.

Jean-Denis Muys

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to