我是SQL的新手。这没有任何结果......
SELECT media.id as mediaid, media.title as mediatitle,
media.description as mediadescription, media.date as mediadate,
media.duration, media.price as mediaprice, media.thumburl as thumburl,
presenters.f_name as firstname, presenters.l_name as lastname,
presenters.credentials
FROM `media`
WHERE media.title = 'Code of Ethical Conduct'
LEFT JOIN `presenters` ON presenters.fkMediaID = media.id
但在我添加演示者部分之前,它工作得很好......
SELECT media.id as mediaid, media.title as mediatitle,
media.description as mediadescription, media.date as mediadate,
media.duration, media.price as mediaprice, media.thumburl as thumburl
FROM `media`
WHERE media.title = 'Code of Ethical Conduct'
任何想法为什么?
答案 0 :(得分:9)
WHERE子句最后一次
所以它将来自媒体LEFT JOIN演示者.....
WHERE media.title ....
答案 1 :(得分:3)
LEFT JOIN部分应该是之前 WHERE部分。
SELECT media.id as mediaid, media.title as mediatitle,
media.description as mediadescription, media.date as mediadate,
media.duration, media.price as mediaprice, media.thumburl as thumburl,
presenters.f_name as firstname, presenters.l_name as lastname,
presenters.credentials
FROM media
LEFT JOIN presenters ON presenters.fkMediaID = media.id
WHERE media.title = 'Code of Ethical Conduct'