Cindy,<br><br><br>You may also want to try changing<br><br>&gt; WHERE items.ccode = &#39;BK%&#39;<br><br>...to...<br><br>WHERE items.ccode LIKE &#39;BK%&#39;<br><br>...if you&#39;re trying to match on any ccode starting with &quot;BK&quot;<br>
<br><br>Also, I&#39;m not sure if your ILS has this or not, but in Koha 3.2 and above there is a neat feature in Reports called Runtime Parameters.  You can add a place-holder for things like item type or collection code, and rather than specifying them directly in the report, you&#39;ll be prompted to add the limitation (or pick from a dropdown) when you run the report.  This can greatly consolidate the number of reports you need to save, and provide consistency in output (though, with Koha 3.4 and greater, you have filters on the reports list so you can find which ones you need without scrolling through the complete list).<br>
<br>Cheers,<br><br><br>-Ian<br><br><div class="gmail_quote">On Thu, Jun 30, 2011 at 11:01 PM, Chris Cormack <span dir="ltr">&lt;<a href="mailto:chris@bigballofwax.co.nz">chris@bigballofwax.co.nz</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On 29 June 2011 10:24, Cindy Weber &lt;<a href="mailto:cweber@scls.lib.wi.us">cweber@scls.lib.wi.us</a>&gt; wrote:<br>
&gt; I&#39;m trying to write a report that will list items with the number of<br>
&gt; holds/items over a certain number and then list the number of holds<br>
&gt; placed per library.  Since the holds to items ratio is different<br>
&gt; depending on the format of the item (book, DVD, CD, etc.) I&#39;m thinking<br>
&gt; I&#39;ve got to have one report for each item type.<br>
&gt;<br>
&gt; My initial attempt:<br>
&gt; SELECT biblio.biblionumber, reserves.branchcode AS &#39;Library&#39;,<br>
&gt; biblio.title AS &#39;Title&#39;, COUNT(items.biblionumber) AS &#39;Copies&#39;,<br>
&gt; COUNT(reserves.biblionumber) AS &#39;Holds&#39;<br>
&gt; FROM biblio<br>
&gt; LEFT JOIN items ON (items.biblionumber = biblio.biblionumber)<br>
&gt; LEFT JOIN reserves ON (reserves.biblionumber = items.biblionumber)<br>
&gt; LEFT JOIN biblioitems ON (biblioitems.biblionumber = biblio.biblionumber)<br>
&gt; WHERE items.ccode = &#39;BK%&#39;<br>
&gt; GROUP BY biblio.biblionumber HAVING<br>
&gt; (COUNT(reserves.biblionumber)/COUNT(items.biblionumber)) &gt; 15<br>
&gt;<br>
&gt;<br>
&gt; When trying to troubleshoot why this didn&#39;t return any results, I<br>
&gt; discovered that<br>
&gt; SELECT biblio.title, COUNT(items.biblionumber), COUNT(reserves.biblionumber)<br>
&gt; FROM biblio<br>
&gt; JOIN items ON (items.biblionumber = biblio.biblionumber)<br>
&gt; JOIN reserves ON (reserves.biblionumber = biblio.biblionumber)<br>
&gt;<br>
&gt; returned really large numbers and the items and holds numbers wer all<br>
&gt; equal.  For a specific bibionumber, it gave me 520 for both the count of<br>
&gt; items and the count of reserves.  There are 8 holds and 65 items for<br>
&gt; that biblionumber.  So it&#39;s multiplying the two counts together and<br>
&gt; returning that as the result.  Changing the JOIN types didn&#39;t help any.<br>
&gt; Can anyone please tell me what I&#39;m doing wrong and how to fix this?<br>
&gt;<br>
</div></div>Hi Cindy<br>
<br>
We can try, but since you aren&#39;t running an official release of Koha,<br>
we can only guess at your database structure.  What you probably want<br>
to do, is group the results by biblionumber. You are trying to find<br>
out the number of reserves, and the number of items for each<br>
biblionumber right?<br>
<font color="#888888"><br>
Chris<br>
</font><div><div></div><div class="h5">_______________________________________________<br>
Koha mailing list  <a href="http://koha-community.org" target="_blank">http://koha-community.org</a><br>
<a href="mailto:Koha@lists.katipo.co.nz">Koha@lists.katipo.co.nz</a><br>
<a href="http://lists.katipo.co.nz/mailman/listinfo/koha" target="_blank">http://lists.katipo.co.nz/mailman/listinfo/koha</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Ian Walls<br>Lead Development Specialist<br>ByWater Solutions<br>ALA Booth 732<br>Phone # (888) 900-8944<br><a href="http://bywatersolutions.com" target="_blank">http://bywatersolutions.com</a><br>
<a href="mailto:ian.walls@bywatersolutions.com" target="_blank">ian.walls@bywatersolutions.com</a><br>Twitter: @sekjal<br>