Quantcast
Channel: GSAK Forum
Viewing all articles
Browse latest Browse all 75048

Help to write a macro by lignumaqua - 2013-07-03

$
0
0
I think it's a little easier than that and can be done in a single SQL statement. Try running this:

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. dry.gif 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.

Viewing all articles
Browse latest Browse all 75048

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>