我有两个MySQL表:
tbsongs:
tbalbums:
我正在尝试从tbsongs进行查询以添加来自tbalbums的字段,但是我收到错误,并且找不到错误的位置。
您可以在此查询:
$rs = mysql_query("SELECT * FROM tbsongs where tbsongs.index='$id'
LEFT JOIN tbalbums AS nombreAlbum ON tbsongs.album = tbalbums.idAlbums ORDER BY titulo asc");
答案 0 :(得分:2)
WHERE
在任何JOIN
和 ORDER BY
之后
SELECT
n.*,m.*
FROM tbsongs n
LEFT JOIN tbalbums m ON n.album = m.idAlbums
WHERE n.index='$id'
ORDER BY n.titulo ASC