[Koha] SQL help please

Barton Chittenden barton at bywatersolutions.com
Wed Apr 12 18:58:46 NZST 2017


Kerrie,

Just to be sure that I'm understanding you here ... you wan to list the
item if it's held at 'QLD', but *not* if it's held at 'QLD' but also held
at another branch?

I think this will work:

SELECT
    items.itemnumber,
    biblio.title,
    biblio.author,
    items.itemcallnumber,
    items.barcode
FROM
    items
    LEFT JOIN biblio ON (items.biblionumber=biblio.biblionumber)
WHERE NOT CONTAINS ( SELECT * FROM items WHERE items.homebranch != 'QLD' )
ORDER BY items.itemcallnumber


On Wed, Apr 12, 2017 at 1:20 AM, Kerrie Stevens <KStevens at harvest.edu.au>
wrote:

> I have this report that lists all the items in our QLD library but I want
> to restrict it to items ONLY held in our QLD library and not another
> branch... I don't know where to put the DISTINCT tag? Please advise:
>
> SELECT items.itemnumber, biblio.title, biblio.author,
> items.itemcallnumber, items.barcode
> FROM items
> LEFT JOIN biblio ON (items.biblionumber=biblio.biblionumber)
> WHERE items.homebranch='QLD'
> ORDER BY items.itemcallnumber
>
> Thanks for your help,
>
> Kerrie Stevens
> Harevst Bible College
>
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha at lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha
>


More information about the Koha mailing list