Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Align two mysql tables

Tags:

php

mysql

I have two databases. WordpressDB and JoomlaDB

WordpressDB has table db1_users JoomlaDB has table db2_users

thoose tables has the same fields names

id  | email | Login | Password

General database is WordpressDB. So i need all id in JoomlaDB make the same as id in WordpressDB where email field is the same.

So how to do that, it is about 10.000 entries?

like image 746
Dmitrij Holkin Avatar asked May 16 '26 15:05

Dmitrij Holkin


1 Answers

I don't know if this is right or not, but if you're looking for query to update ID in table joomla using data ID in table wordpress, I think you can use this :

update WordpressDB.tbl_user1 
set WordpressDB.tbl_user1.ID=(
select JoomlaDB.tbl_user2.ID from JoomlaDB.tbl_user2 
where JoomlaDB.tbl_user2.EMAIL=WordpressDB.tbl_user1.EMAIL
) 
like image 98
Rifai Avatar answered May 18 '26 04:05

Rifai