我使用php和mysql创建字母表A-Z的分页。我在表格中为单字母A记录单个记录。当我查询记录时,它将返回多行而不是单行。另外,链接表仅包含A的电影ID的单行记录。任何表格中都没有一对多的关系。如果我在那里做了任何错误,请通过下面的查询来纠正。提前致谢。查询返回多行?
select
M.name,
M.id, (select year(M.released_date))as year,
MS.storyrating,
S.screenplayrating,
MS.dialoguerating,
MS.directionrating,
MS.musicrating,
MS.bgmrating,
MS.cinematographyrating,
MS.characterizationrating,
MS.shotlocationrating,
MS.editingrating,
MS.productionrating,
MI.director,
MI.musicdirector
from tttbl_movie M, tttbl_movie_info MI, tttbl_movie_score MS
where M.id=MI.movie_id
and M.id=MS.movie_id
AND M.name 'A%' OR M.name 'a%'
ORDER BY M.name ASC LIMIT 0,2;
促进使用显式'JOIN' sintaxis,Aar在伯特兰写了一篇不错的文章[踢坏的习惯:使用旧式JOIN](http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/08/bad-habits-to-kick-using-old -style-joins.aspx)。 –