我寫了一個內部連接來從一個數據庫中的三個表中提取信息。當我運行查詢時,我得到兩行返回,第二行是第一行的副本。我希望只有一行被返回?爲什麼SQL查詢在只有一行存在時返回兩行?
查詢:
mysql> SELECT euroapps.id, euroapps.name, euroapps.imageurl, euroapps.website,
euroapps.developer, euroapps.description, euroapps.created, euroapps.iphone,
euroapps.ipodtouch, euroapps.ipad, app_detail.screen1 , app_detail.screen2,
app_detail.screen3, app_detail.screen4, application_price.retail_price
FROM euroapps INNER JOIN app_detail ON euroapps.id = app_detail.id
INNER JOIN application_price ON euroapps.id= application_price.application_id
WHERE euroapps.id = 353783927;
返回兩行,而這一個只返回一個行(和預期)
mysql> SELECT euroapps.id, euroapps.name, euroapps.imageurl, euroapps.website,
euroapps.developer, euroapps.description, euroapps.created, euroapps.iphone,
euroapps.ipodtouch, euroapps.ipad, app_detail.screen1 , app_detail.screen2,
app_detail.screen3, app_detail.screen4
FROM euroapps INNER JOIN app_detail ON euroapps.id = app_detail.id
WHERE euroapps.id = 353783927;
此查詢是否返回2行'select * from application_price WHERE application_price.application_id = 353783927;'?如果是這樣,那就是答案。 – Augusto 2011-04-28 16:07:28