I have two tables in my database, and I'm trying to compare phone prices from both db's. The phone models are the same, but have different spelling (as you see on table1 (model) and table2 (model)). Actually I want to check if table2 has cheaper model as table1 and output it as MODEL, PRICE1, PRICE2.
TABLE1
id date manufac model price
1 2016-06-26 SAMSUNG A3 A300F BLACK 187
2 2016-06-26 SAMSUNG A5 A500H BLACK 239
3 2016-06-26 SAMSUNG J5 J300F GOLD 185
TABLE2
id date manufac model price
1 2016-06-26 SAMSUNG A300F A3 180
2 2016-06-26 SAMSUNG A500H A5 232
3 2016-06-26 SAMSUNG J300F J5 GOLD 172
I've tried using the following query with no success:
SELECT table1.model AS "MODEL",
table1.price AS "PRICE TABLE1",
table2.price AS "PRICE TABLE2"
FROM table1, table2
WHERE table1.model LIKE CONCAT('%', table2.model, '%');
Have you guys got any ideas how to solve this issue?