I've seen UNION used to join those two tables in queries. I'm imaginning something like:
SELECT YEAR(issuedate), MONTH(issuedate), categorycode, COUNT(DISTINCT borrowernumber) FROM ( SELECT issuedate,categorycode,borrowernumber FROM old_issues UNION ALL SELECT issuedate,categorycode,borrowernumber FROM issues ) LEFT JOIN borrowers USING (borrowernumber) GROUP BY YEAR(issuedate), MONTH(issuedate), categorycode; But I'm no database expert, so use this with care. On Mon, Jan 9, 2012 at 1:12 PM, Cab Vinton <bibli...@gmail.com> wrote: > A couple years ago Jesse Weaver came up with this report for active > borrowers (i.e., patrons checking out materials): > > SELECT YEAR(issuedate), MONTH(issuedate), categorycode, > COUNT(DISTINCT borrowernumber) > FROM old_issues > LEFT JOIN borrowers USING (borrowernumber) > GROUP BY YEAR(issuedate), MONTH(issuedate), categorycode; > > I'm wondering if the caveat he notes is still true: > > Because it uses old_issues, it won't include anything that's still > checked out; getting > around that requires either ugly subqueries or running the report > with old_issues > and issues and manually combining the results. > > Is there a relatively easy way to modify the report so it includes > patrons who may still have items checked out? > > Thanks for any assistance! > > Cab Vinton, Director > Sanbornton Public Library > Sanbornton, NH > > "Politeness and consideration for others is like investing pennies and > getting dollars back." Thomas Sowell > _______________________________________________ > Koha-devel mailing list > Koha-devel@lists.koha-community.org > http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel > website : http://www.koha-community.org/ > git : http://git.koha-community.org/ > bugs : http://bugs.koha-community.org/ >
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/