WL-2371 Fix the importer so it works on MySQL.

In refactoring to HSQL and removing the join it broken on MySQL as when performing an update you can't reference the table you are updating in the subselect. The way around this (from StackOverflow.com) is to wrap the subselect, but todo this we need to go back from HQL to SQL.