Borrowers Table Uniqueid
A recent update to Koha 3.19 pointed out that I have some records in the Borrowers Table that lack a UniqueID so that the UniqueID field could not be made "unique". I need to update the records in this table. Is there an easy way to do this via mysql? Thanks, Phillip
First, identify those duplicated userid's. (Beware it talks about 'userid', not 'uniqueid'):
SELECT userid FROM (SELECT userid,COUNT(userid) AS the_count FROM borrowers GROUP BY userid) a WHERE the_count > 1;
Then I'd go look at each of the (at least) duplicated userid's like this:
SELECT firstname, surname, email, cardnumber FROM borrowers WHERE userid=<pick one>;
I usually just picked the cardnumber as the new userid:
UPDATE borrowers SET userid=cardnumber WHERE userid=<pick one>;
You could go with the email, it really depends on your taste/common practices. This is not ideal, but should do the work. Good luck Note: You will probably find several userid's to be NULL. In that case, the second query should be like:
SELECT firstname, surname, email, cardnumber FROM borrowers WHERE userid IS NULL;
and so the UPDATE query. 2015-12-21 7:35 GMT-03:00 Phillip Ponchot <pponchot@live.com>:
A recent update to Koha 3.19 pointed out that I have some records in the Borrowers Table that lack a UniqueID so that the UniqueID field could not be made "unique".
I need to update the records in this table. Is there an easy way to do this via mysql?
Thanks,
Phillip
_______________________________________________ Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz https://lists.katipo.co.nz/mailman/listinfo/koha
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B76C 6E7C 2D80 551A C765 E225 0A27 2EA1 B2F3 C15F
participants (2)
-
Phillip Ponchot -
Tomas Cohen Arazi