I have two tables in my database.
Movies
table:
+----------------------------------------
| ID | title | timestamp |
+----------------------------------------
| 1 | The host | time |
| 2 | Fight Club | time |
| 4 | 21 | time |
----------------------------------------+
电影链接
表:
+---------------------------------------+
| ID | link | movie_id |
+---------------------------------------+
| 1 | some link | 1 |
| 2 | some link | 1 |
| 3 | some link | 1 |
+---------------------------------------+
目前,我只从Movies
表中选择标题类似于以下示例的行:
SELECT * FROM `Movies`
WHERE `title` LIKE '%The Host%'
ORDER BY `timestamp` DESC DESC LIMIT 30
但是我想做的与上面相同的查询,但是要连接Movie_Links
表,其中movie_id
等于Movies
表的ID
,并获取所有链接,其中Movie_id
等于1
。