I have two tables in my database.
Movies table:
+----------------------------------------
| ID | title | timestamp |
+----------------------------------------
| 1 | The host | time |
| 2 | Fight Club | time |
| 4 | 21 | time |
----------------------------------------+
Movie_Links table:
+---------------------------------------+
| ID | link | movie_id |
+---------------------------------------+
| 1 | some link | 1 |
| 2 | some link | 1 |
| 3 | some link | 1 |
+---------------------------------------+
At the moment I am only selecting the rows from the Movies table where the title is like for example:
SELECT * FROM `Movies`
WHERE `title` LIKE '%The Host%'
ORDER BY `timestamp` DESC DESC LIMIT 30
But what I want to do is the same query as above but join Movie_Links table where movie_id equals Movies table's ID and get all links that have a Movie_id equal to 1.
SQL join two tables With IDs match
SELECT *
FROM Movies
LEFT JOIN Movie_Links
ON Movies.ID = Movie_Links.movie_id;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With