Compare two tables in Mysql [closed]

1

I am uploading two files from Excel to a JSP to save it in MySQL the first file with its columns:

|------------------| 
| Archivos_nombres |
|------------------|
| identificación   |
| nombre_j         |
| nombre_n         |
|------------------|

Second file:

|------------------| 
| Empleado         |
|------------------|
| identificación_J |
| nombre_j         |
| otros campos mas |
|------------------|

What I need is that when I upload the file Employee of Excel to save it in Mysql , I need to make a comparison of these two files by means of the field nombre_j for if the names are equal take the data that is saved in identification to the field identificacion_J in the other table, how can you do this thank you very much

    
asked by victormbrt 12.01.2017 в 15:53
source

1 answer

0

I think the logic would be something like that.

$sql= "UPDATE empleado a INNER JOIN archivo_nombre b
ON a.nombre_j = b.nombre_j
SET a.identificacion_j = b.identificacion";
  

Obviously you should clean the fields because if there are blank spaces or strange characters, the comparison will be false.

    
answered by 12.01.2017 в 16:27