+my ($StartMonth,$EndMonth);
+# if '-a' is set, set start/end month from database
+# FIXME - it doesn't make that much sense to get first/last month from database to query it
+# with a time period that equals no time period ...
+if ($Options{'a'}) {
+ undef($Options{'m'});
+ undef($Options{'p'});
+ my $DBQuery = $DBHandle->prepare(sprintf("SELECT MIN(month),MAX(month) FROM %s.%s",$Conf{'DBDatabase'},$Conf{'DBTableGrps'}));
+ $DBQuery->execute or die sprintf("$MySelf: E: Can't get MIN/MAX month from %s.%s: %s\n",$Conf{'DBDatabase'},$Conf{'DBTableGrps'},$DBI::errstr);
+ ($StartMonth,$EndMonth) = $DBQuery->fetchrow_array;
+} else {
+ ($StartMonth,$EndMonth) = &GetTimePeriod($Options{'m'},$Options{'p'});
+};