1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
mysql> CREATE TABLE tbl_Test1(
-> ID INT,
-> Phone VARCHAR(35));
Query OK, 0 rows affected (0.01 sec)
mysql>
mysql> CREATE TABLE tbl_Test2(
-> ID INT,
-> Vorname VARCHAR(36),
-> PhoneLike VARCHAR(29));
Query OK, 0 rows affected (0.00 sec)
mysql> insert into tbl_Test1 values(1,123456);
Query OK, 1 row affected (0.00 sec)
mysql> insert into tbl_Test1 values(2,7235);
Query OK, 1 row affected (0.00 sec)
mysql> insert into tbl_Test2 values(1,'Teutales',1234);
Query OK, 1 row affected (0.00 sec)
mysql> select * FROM tbl_Test1, tbl_Test2 WHERE tbl_Test1.Phone like CONCAT(tbl_Test2.PhoneLike,'%');
+------+--------+------+----------+-----------+
| ID | Phone | ID | Vorname | PhoneLike |
+------+--------+------+----------+-----------+
| 1 | 123456 | 1 | Teutales | 1234 |
+------+--------+------+----------+-----------+
1 row in set (0.00 sec)