https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40057

Jonathan Druart <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]

--- Comment #11 from Jonathan Druart <[email protected]> ---
(In reply to Marcel de Rooy from comment #9)
> Just curious
> SELECT COUNT(*) FROM illrequests WHERE borrowernumber NOT IN (SELECT
> borrowernumber FROM borrowers)
> UPDATE illrequests SET borrowernumber = NULL WHERE borrowernumber NOT IN
> (SELECT borrowernumber FROM borrowers)
> Wouldnt a join on borrowers with a NULL test be better? No big deal.

I came here to say that.

This is really not the best we can do.

The following query using LEFT JOIN should work:

UPDATE illrequests AS ill
LEFT JOIN borrowers AS b ON ill.borrowernumber = b.borrowernumber
SET ill.borrowernumber = NULL
WHERE b.borrowernumber IS NULL;

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to