Ver Mensaje Individual
  #7 (permalink)  
Antiguo 18/05/2017, 06:21
Avatar de gnzsoloyo
gnzsoloyo
Moderador criollo
 
Fecha de Ingreso: noviembre-2007
Ubicación: Actualmente en Buenos Aires (el enemigo ancestral)
Mensajes: 23.324
Antigüedad: 16 años, 4 meses
Puntos: 2658
Respuesta: Comprobar valor campo Tabla1 con cadena campo Tabla2

Pues algo estás escribiendo mal...
Código SQL:
Ver original
  1. mysql> DROP TABLE IF EXISTS table1;
  2. Query OK, 0 ROWS affected (0.05 sec)
  3.  
  4. mysql> DROP TABLE IF EXISTS table2;
  5. Query OK, 0 ROWS affected (0.05 sec)
  6.  
  7. mysql> CREATE TABLE table1(id_table1 INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, texto VARCHAR(1000));
  8. Query OK, 0 ROWS affected (0.09 sec)
  9.  
  10. mysql> CREATE TABLE table2(id_table2 INT UNSIGNED AUTO_INCREMENT PRIMARY KEY, fuente VARCHAR(100));
  11. Query OK, 0 ROWS affected (0.11 sec)
  12.  
  13. mysql> INSERT INTO table2(fuente) VALUES('Pepe, Feliz 1066');
  14. Query OK, 1 ROW affected (0.03 sec)
  15.  
  16. mysql> INSERT INTO table1(id_table1, texto) VALUES(1066, 'Texto de prueba');
  17. Query OK, 1 ROW affected (0.03 sec)
  18.  
  19. mysql> SELECT * FROM table2 INNER JOIN table1 WHERE table2.fuente LIKE CONCAT('%', table1.id_table1, '%');
  20. +-----------+------------------+-----------+-----------------+
  21. | id_table2 | fuente           | id_table1 | texto           |
  22. +-----------+------------------+-----------+-----------------+
  23. |         1 | Pepe, Feliz 1066 |      1066 | Texto de prueba |
  24. +-----------+------------------+-----------+-----------------+
  25. 1 ROW IN SET (0.00 sec)
__________________
¿A quién le enseñan sus aciertos?, si yo aprendo de mis errores constantemente...
"El problema es la interfase silla-teclado." (Gillermo Luque)