Skip to content

Instantly share code, notes, and snippets.

@jsicot
Last active August 29, 2015 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsicot/10653840 to your computer and use it in GitHub Desktop.
Save jsicot/10653840 to your computer and use it in GitHub Desktop.
NbreNoticesCcodes2013
SELECT
i.ccode AS ccode,
count(DISTINCT(b.biblionumber)) as total
FROM
(SELECT biblionumber,barcode,ccode,dateaccessioned,itemlost,wthdrawn,timestamp FROM items) i
LEFT JOIN biblio as b ON b.biblionumber=i.biblionumber
WHERE (YEAR(b.datecreated) = '2013')
AND i.barcode IS NOT NULL
GROUP BY i.ccode
ORDER BY total DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment