[英]What should I do to join 2 tables based on a condition?
SELECT * FROM imdb_index AS x JOIN book_details AS y ON x.isbn = y.isbn
WHERE x.imdb_index>=600;
有關加入的更多詳細信息,請訪問https://www.mysqltutorial.org/mysql-join/
where 和 join 子句放錯了地方
select *
from imdb_index x
join book_details y on x.isbn=y.isbn
where y.imdb_index>=600 ;
join 子句必須在 where 子句之前
通過使用以下查詢,您將能夠從 imdb_index >=600 的表中獲取數據。
select *
from imdb_index as im
join book_details as bd
on im.isbn = bd.isbn
where im.imdb_index>=600;
您在join
之前使用where
條件。您應該先Join
,然后才應該使用where
強烈建議閱讀和觀看一些關於joins
的教程。
以下鏈接將對您有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.