[Koha] SQL help - Bulk Card Number modification

Radek Šiman radek.siman at centrum.cz
Fri Jan 19 20:45:58 NZDT 2018


Hi Satish,

maybe this piece of SQL code could help you... Please adjust the 
parameters @prefix and @offset. In the case you're satisfied with 
results, use the formulas in your UPDATE command.

Regards,
Radek

select * FROM (
     SELECT
         @prefix:="4GH" as cardnumber,
         @offset:=17 as university_id
     ) as vars
where 0 = 1

union

select
     cardnumber,
     CONCAT(
         @prefix,
         left(cardnumber, 2),
         MID(cardnumber, 3, 2),
         @offset + CAST(right(cardnumber, 2) as UNSIGNED INT)
     ) as university_id
from borrowers

Dne 19.01.18 v 7:21 SATISH napsal(a):
> Dear Ramakant,
>
> Yes, I did the same way for modification of a single cardnumber.
> but how to do it for bulk? and also data is in excel.
>
> with thanks
> satish
> _______________________________________________
> 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