[Koha-devel] Active borrowers report

Galen Charlton gmc at esilibrary.com
Mon Jan 9 21:31:54 CET 2012


Hi,

On 01/09/2012 03:30 PM, Mike Hafen wrote:
> 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;

A UNION ALL is indeed a valid way to do it.

Regards,

Galen
-- 
Galen Charlton
Director of Support and Implementation
Equinox Software, Inc. / The Open Source Experts
email:  gmc at esilibrary.com
direct: +1 770-709-5581
cell:   +1 404-984-4366
skype:  gmcharlt
web:    http://www.esilibrary.com/
Supporting Koha and Evergreen: http://koha-community.org & 
http://evergreen-ils.org


More information about the Koha-devel mailing list