I think it's a little easier than that and can be done in a single SQL statement. Try running this:
This gives you a list of date ranges where you have at least 10 counties in the ten days, and also tells you how many cache types you found in that same ten days. I don't qualify.
I have two date ranges with 10 counties, but only 4 cache types in those date ranges. ![smile.gif]()
![user posted image]()
Without the index this is relatively slow, but with the index it's quick. Just a second or so to run against my 5,000 finds.
GSK |
$_sql = "create index if not exists founddate on caches (foundbymedate)" $status = Sqlite("sql",$_sql) $_sql = "select t1.foundbymedate as StartDate, date(t1.foundbymedate, '+9 day') as EndDate, count(distinct t2.county) as Counties, count(distinct t2.cachetype) as Types from caches as t1, caches as t2 where t2.foundbymedate >= startdate and t2.foundbymedate <= enddate group by startdate having counties >=10 order by counties desc" $result = Sqlite("sql",$_sql,"Headings=yes") $_sql = "drop index founddate" $status = Sqlite("sql",$_sql) $html = SqlToHtml($result,"500 Cache Challenge","y") |
This gives you a list of date ranges where you have at least 10 counties in the ten days, and also tells you how many cache types you found in that same ten days. I don't qualify.



Without the index this is relatively slow, but with the index it's quick. Just a second or so to run against my 5,000 finds.