[Koha] delete inventory of one library
Rachel Hollis
Rachel.Hollis at stevenshenager.edu
Fri Jan 28 08:20:29 NZDT 2011
Thank you Chris! You can be sure I'll back up the DB! :-)
So my first step is to make sure that all items in the library to be removed have an available status, correct?
The library to be removed shares a Home Library but does have a separate Shelving Location. (Good thing too because I've noticed that there are items that have different Home Libraries but with the same Shelving Location and these also need to be removed.) Would the query look like
SELECT barcode FROM items WHERE items.location='location to be removed' INTO OUTFILE '/tmp/barcodes';
What I really like about this project is that only the barcodes for the one location will be deleted leaving other items on a shared biblio, sweet! Another awesome thing is that the library/location to be removed has not used Acquisitions or Serials.
I've been asked why we are deleting a library and its inventory. The library will be using another automation system; I wish them luck with their project.
Rachel Hollis, librarian
-----Original Message-----
From: Chris Cormack [mailto:chris at bigballofwax.co.nz]
Sent: Wednesday, January 26, 2011 1:38 PM
To: Rachel Hollis
Cc: Koha at lists.katipo.co.nz
Subject: Re: [Koha] delete inventory of one library
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
This message is for the designated recipient only and may contain privileged, proprietary, or otherwise private information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email by you is prohibited.
More information about the Koha
mailing list