I am posting this blog because I was facing issue to show the total common counts in 3rd column from two columns. This is following table which contain these records:
|==========title=================|======title================|
|...Cat Dog......................|...Cat.... .... ...........|
|....Titanic Bag Cream...........|...Bag Titanic Butter......|
|....Apple Banana Mangoe.........|...Tomatoe Tree. Butter....|
I need to get the following output:
|==========title=================|======title================|===OUTPUT===|
|...Cat Dog......................|...Cat.... .... ...........| 1 |
|....Titanic Bag Cream...........|...Bag Titanic Butter......| 2 |
|....Apple Banana Mangoe.........|...Tomatoe Tree. Butter....| 0 |
Solution was very simple, just write this query to get the output:
SELECT table1.title title1, table2.title title2
FROM table1, table2
WHERE table1.title LIKE CONCAT('%',table2.title,'%')
OR table2.title LIKE CONCAT('%',table1.title,'%');
0 Comment(s)