Rick Ratchford <r...@amazingaccuracy.com>
wrote:
> Can someone help me with a SQL request?
>
> The Table contains Date, as well as Year, Month and Day columns.
>
> I would like to return a recordset that is made up of only COMPLETE
> YEARS, from January to December.
>
> Say my data starts on August 14, 1975 and ends with May 4, 2009.
>
> How do I get just those records that start from January 1, 1976 to
> December 31, 2008, as those would be the only COMPLETE YEARS from
> January to December in my table?

Perhaps something like this:

select * from myTable
where Year between
    (select min(Year) from myTable where Month=1 and Day=1)
and
    (select max(Year) from myTable where Month=12 and Day=31);

Igor Tandetnik



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

Reply via email to