I have these tables in my MySQL database:
Cars table:
+----Cars Table-----+
+---------------------+
| id | BMW | KIA |-and another cars
+----+----------+-----+
| 1 | M5 | Rio |
| 2 | Z1 | Serato |
| 3 | X5 | Sorento|
Like table:
+----------------------+-----+
| id | Cars_id| Cars |ip |
+----+----------+------+-----+
| 1 | 1 | KIA |1.0.1|
| 2 | 1 | BMW |1.0.1|
Basically, the Cars table have more cars Mark and their models.
My question is, how Join this tables - Like.Cars_id=Cars.id and Like.Cars=Cars.Column names?.
So, I would like a query like this:
SELECT Cars.BMW, Cars.KIA, COUNT(Like.ip) AS likes
FROM CARS_Table
LEFT JOIN Like_table
ON Cars.id = Like.Cars_id AND what?