Fix our custom UPDATE TABLE call for local_id to work with mysql
Fix our custom UPDATE TABLE call for local_id to work with mysql

Our special sql statement for setting the local_id based on a maximum of the
other local_ids in the table or 1 didn't work with mysql. This is because mysql
doesn't allow you to update a table and select from it at the same time. This is
fixable by selecting the results into a derived table and then selecting the
match from that.

chazy/reviewboard,beol/reviewboard,chazy/reviewboard,Khan/reviewboard,1tush/reviewboard,reviewboard/reviewboard,Khan/reviewboard,beol/reviewboard,custode/reviewboard,KnowNo/reviewboard,Khan/reviewboard,1tush/reviewboard,reviewboard/reviewboard,chazy/reviewboard,brennie/reviewboard,custode/reviewboard,brennie/reviewboard,sgallagher/reviewboard,Khan/reviewboard,bkochendorfer/reviewboard,brennie/reviewboard,davidt/reviewboard,atagar/ReviewBoard,beol/reviewboard,Khan/reviewboard,chipx86/reviewboard,Khan/reviewboard,KnowNo/reviewboard,davidt/reviewboard,sgallagher/reviewboard,chazy/reviewboard,reviewboard/reviewboard,chipx86/reviewboard,beol/reviewboard,1tush/reviewboard,1tush/reviewboard,1tush/reviewboard,Khan/reviewboard,davidt/reviewboard,chazy/reviewboard,1tush/reviewboard,1tush/reviewboard,chazy/reviewboard,chazy/reviewboard,chazy/reviewboard,sgallagher/reviewboard,reviewboard/reviewboard,bkochendorfer/reviewboard,bkochendorfer/reviewboard,chipx86/reviewboard,custode/reviewboard,atagar/ReviewBoard,Khan/reviewboard,KnowNo/reviewboard,chipx86/reviewboard,Khan/reviewboard,atagar/ReviewBoard,1tush/reviewboard,atagar/ReviewBoard,sgallagher/reviewboard,bkochendorfer/reviewboard,atagar/ReviewBoard,brennie/reviewboard,1tush/reviewboard,atagar/ReviewBoard,atagar/ReviewBoard,custode/reviewboard,KnowNo/reviewboard,atagar/ReviewBoard,davidt/reviewboard,atagar/ReviewBoard,chazy/reviewboard