I ran your query and most of the users were deleted but I still have 6310 users that are disabled. I tried a simple delete * from users where isapproved = 0 and got the following message:
How can I get rid of these duplicates without manually clicking delete 6310 times?The DELETE statement conflicted with the REFERENCE constraint "ac_Addresses_ac_BasketShipments_FK1". The conflict occurred in database "ac7_serenecomfort", table "dbo.ac_BasketShipments", column 'AddressId'.
Also, we have found we cannot search the legacy users by last name, first name, etc but if I look in the ac_addresse table, they are there. For example, if I search the administration for users with the last name of mcgrath, I get no results. However if I run a the query select * from dbo.ac_addresses where lastname = 'mcgrath' 15 users are returned.
If I take the email address from the results of that query and search in the admin for usernames matching it, the information is returned.
It looks like some relationship was broken during the import. One item to note is that most of this store's 5.5 users were anonymous users and where they were not the username did not equal the email address.
I am really confused about what happened during the user import.