Additionally if you're in a system in a consortium (versus single library)
you may want not just for one library but for your library system you may
want to make a join and go by parent org ie...

SELECT COUNT(action.circulation.id) AS Circs
  FROM action.circulation circ
JOIN actor.org_unit org on org.id = circ.circ_lib
WHERE DATE(xact_start) BETWEEN '2012-01-01' AND '2012-12-31'
    AND org.parent_ou = XXX /*Put library system org id found in
actor.org_unit.id*/
    AND circ.phone_renewal IS FALSE /*Remove this if you want Phone
renewals to be counted*/
    AND circ.desk_renewal IS FALSE /*Remove this if you want Circ Desk
renewals to be counted*/
    AND circ.opac_renewal IS FALSE /*Remove this if you want OPAC renewals
to be counted*/;


On Thu, Apr 11, 2013 at 11:02 AM, Aaron Zsembery <[email protected]>wrote:

> You want the action.circulation table.
>
> I would use the following query:
> SELECT COUNT(action.circulation.id) AS Circs
>   FROM action.circulation
> WHERE DATE(xact_start) BETWEEN '2012-01-01' AND '2012-12-31'
>     AND circ_lib = XXX /*Put your library ID in here, it can be found in
> actor.org_unit.id*/
>     AND phone_renewal IS FALSE /*Remove this if you want Phone renewals to
> be counted*/
>     AND desk_renewal IS FALSE /*Remove this if you want Circ Desk renewals
> to be counted*/
>     AND opac_renewal IS FALSE /*Remove this if you want OPAC renewals to
> be counted*/;
>
> Aaron Z
> Jr. Systems Administrator
>
> Pioneer Library System
> 2557 State Rt. 21
> Canandaigua, New York  14424
> Phone: (585) 394-8260
>
> ------------------------------
>
> *From: *"Jesse Ephraim" <[email protected]>
> *To: *"Evergreen Discussion Group" <
> [email protected]>
> *Sent: *Thursday, April 11, 2013 1:36:47 PM
> *Subject: *[OPEN-ILS-GENERAL] SQL question
>
>
>  I need to count (via SQL) the number of checkout transactions that fall
> with 1/1/2012 and 12/31/2012.  Could someone point me at the right
> table/fields to look at checkout transactions for my library (we are in a
> consortium).
>
>
> Thanks!
>
>
>
> Jesse Ephraim
>
> Director, Roanoke Public Library
>
> * *
>
> *308 S. Walnut*
>
> *Roanoke, TX  76248*
>
> *[email protected]*
>
> *817-491-2691*
>
>
>
>
>


-- 

Rogan Hamby, MLS, CCNP, MIA
Managers Headquarters Library and Reference Services,
York County Library System

"You can never get a cup of tea large enough or a book long enough to suit
me."
-- C.S. Lewis <http://www.goodreads.com/author/show/1069006.C_S_Lewis>

Reply via email to