[Koha] delete inventory of one library

Chris Cormack chris at bigballofwax.co.nz
Thu Jan 27 09:38:15 NZDT 2011


On 27 January 2011 09:23, Rachel Hollis
<Rachel.Hollis at stevenshenager.edu> wrote:
> No need to apologize Chris. I do have command line access to the DB. I am a librarian but there are people here that can help me... er, stop me from breaking things. ;-)
>
WARNING: Please, for your sanity sake, back your db up before doing
the the following :)

Right, in that case, after you have checked in the items that are out
you could run a query like

SELECT barcode FROM items WHERE homebranch='branch you are removing'
INTO OUTFILE '/tmp/barcodes';

That gives you a file containing all the barcodes to delete, you can
then load that up into the batch item deletion tool (in the tools area
in Koha)

Now if you want to get rid of all biblios that have no items attached,
and have no orders attached to them.
NOTE if you use serials you need to be careful here, if you don't then
the next bit of sql is safe

delete from biblio where biblionumber
not in (select biblionumber from items) and biblionumber not in
(select biblionumber from aqorders);

Then you can delete all biblioitems that have no biblio

delete from biblioitems where biblionumber not in (select biblionumber
from biblio);

That should have purged them.
Now if you do use serials, let me know and I can try and figure out
the sql for checking the biblio is not linked to a serial.

Chris


More information about the Koha mailing list