And now that I've actually tried that query, there are problems with it. Here is a fixed version:
SELECT YEAR(issuedate), MONTH(issuedate), categorycode, COUNT(DISTINCT borrowernumber)
FROM (
SELECT issuedate, borrowernumber FROM old_issues
UNION ALL
SELECT issuedate, borrowernumber FROM issues
) AS all_issues
LEFT JOIN borrowers USING (borrowernumber)
GROUP BY YEAR(issuedate), MONTH(issuedate), categorycode
Hi,A UNION ALL is indeed a valid way to do it.
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;
Regards,
Galen
--
Galen Charlton
Director of Support and Implementation
Equinox Software, Inc. / The Open Source Experts
email: gmc@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
_______________________________________________
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/