Hi,
Well, that's not easy to do it properly.
The problem is that since you have several entries for the same email address in the hikashop_user table, it means you might have addresses / orders for the same email address but different entries.
So prior to deleting the duplicate entries, you would first have to update the order_user_id and address_user_id with the user_id that you won't be deleting.
stackoverflow.com/questions/65340539/how...es-duplicate-records
Once you've updated the user_id in the hikashop_order and hikashop_address tables, you can delete the duplicate entries in hikashop_user. And finally, you can add back a unique key on the user_email column of the hikashop_user table. After that, you can update again your HikaShop and you won't get duplicate entries.
The queries should be something like that:
update #__hikashop_address as a join
(select b.*,
min(user_id) over (partition by user_email) as min_id
from #__hikashop_user as b
) b
on a.address_user_id = b.user_id
set a.address_user_id = b.min_id
where a.address_user_id <> b.min_id;
update #__hikashop_order as a join
(select b.*,
min(user_id) over (partition by user_email) as min_id
from #__hikashop_user as b
) b
on a.order_user_id = b.user_id
set a.order_user_id = b.min_id
where a.order_user_id <> b.min_id;
delete b
from #__hikashop_user as b join
(select b.*,
min(user_id) over (partition by user_email) as min_id
from #__hikashop_user as b
) bb
on bb.user_id = b.user_id
where b.user_id <> bb.min_id;
Please note that I didn't test them. I've just replaced the variables with hikashop's based on one of the answers on the link I gave above. So I would recommend you try them on a copy of your database first (or at least that you backup your database so that you can restore it if something goes wrong).
Note also that you need to replace #__ with the table prefix of your Joomla, which I don't know.