Limiting a left join to returning one result?

前端 未结 5 1362
野性不改
野性不改 2021-02-19 21:29

I currently have this left join as part of a query:

LEFT JOIN movies t3 ON t1.movie_id = t3.movie_id AND t3.popularity = 0

The trouble is that

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-19 21:56

    Try this:

    LEFT JOIN 
        (
         SELECT t3.movie_name, t3.popularity   
         FROM movies t3 WHERE t3.popularity = 0 LIMIT 1
        ) XX
         ON  t1.movie_id = XX.movie_id AND XX.popularity = 0
    

提交回复
热议问题