[Koha-devel] SQL Query : multiple items
Paul A
paul.a at navalmarinearchive.com
Mon Jan 20 22:06:14 CET 2014
I'm going round in circles for what I thought would be easy, and will kick
myself later.
Trying to write a "report" that will give me all biblios with more than 1 item:
SELECT
biblionumber, CONCAT('<a
href=\"/cgi-bin/koha/catalogue/detail.pl?biblionumber=',biblionumber,'\">',title,'</a>')
AS Title, author AS Author
FROM biblio b
LEFT JOIN items i USING (biblionumber)
GROUP BY i.ccode
HAVING COUNT(i.itemnumber)>1;
works syntactically, but certainly does not give me the right answers -- it
produces biblios with 0, 1, 2, etc items, and only 83 total lines when I
know that there are thousands...
Logic seems to have deserted me. Help please?
As a bonus, I'd appreciate how to add the items.ccode into the report.
Adding SELECT ccode FROM items either before or after the JOIN fails.
Thanks and br -- Paul
More information about the Koha-devel
mailing list