目前,我有這樣的SQL查詢,試圖從collection_actors
獲取信息:獲取信息與JOIN
SELECT ca.id_imdb AS IMDb_ID,
caat.id_collection AS collection_ID,
ca.data_name AS actors_name
FROM collection_actors AS ca
JOIN collection_actors_assignedto AS caat
ON ca.id_imdb = caat.id_collection
WHERE caat.id_collection = 'tt1104001'
這裏有兩個表的數據庫:
collection_actors
id
id_user
id_imdb
data_name
date_birth
date_added
date_edited
information_ipaddress
collection_actors_assignedto
id
id_user
id_actor
id_collection
date_added
information_ipaddress
的問題是,即使有數據與IMDb ID匹配,我也無法從collection_actors
獲取任何信息!我怎樣才能使這個工作?
'id_collection'的數據類型是什麼?如果它定義爲'int',則使用'WHERE caat.id_collection = tt1104001'。 – 2013-03-25 14:08:39
我認爲你的意思是_tables_,而不是_databases_?如果是這樣,請相應地更正標題和問題。 – CBroe 2013-03-25 14:09:42
你確定你的'collection_actors_assignedto'表中有一個caat.id_collection ='tt1104001'嗎? – 2013-03-25 14:13:42