Looks like you are selecting from the wrong table here...  borrowers should
be items

On Mon, May 16, 2011 at 1:30 AM, Chris Cormack <[email protected]>wrote:

> From: Srdjan Jankovic <[email protected]>
>
> This patch fixes rows in the issues table that have null borrower or item
> numbers
> And stops this being able to happen in the future
>
> Signed-off-by: Chris Cormack <[email protected]>
> ---
>

+    $dbh->do("INSERT INTO old_issues (borrowernumber, itemnumber, date_due,
branchcode, issuingbranch, returndate, lastreneweddate, `return`, renewals,
timestamp, issuedate)
+              SELECT borrowernumber, itemnumber, date_due, branchcode,
issuingbranch, returndate, lastreneweddate, `return`, renewals, timestamp,
issuedate FROM issues WHERE NOT EXISTS (SELECT * FROM borrowers WHERE
itemnumber = issues.itemnumber)");
+    $dbh->do("DELETE FROM issues WHERE NOT EXISTS (SELECT * FROM items
WHERE itemnumber = issues.itemnumber)");
_______________________________________________
Koha-patches mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-patches
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to