我想加入5个表,我的查询是:
SELECT maingenre.MainGenreId,maingenre.Name AS mname,'saewill.mp3' AS mp3,releaseprod.ArtistId,r me
FROM maingasdsadenre
LEFT JOIN releasaddsaseprod ON maidssadngenre.MainGenreId = dd.a
LEFT JOIN artist ON d.ArtistId = d.ArtistId
l
它没有给我一个准确的结果。 我有这个错误:
#1066 - Not unique table/alias: 'releaseprod'
答案 0 :(得分:1)
如果您的加入始终在releaseprod
尝试此
SELECT maingenere.MainGenreId,
maingenere.Name AS mname,
'saewill.mp3' AS mp3,
releaseprod.ArtistId,
releaseprod.MainGenreId,
releaseprod.LabelId,
artist.ArtistId,
artist.Name AS aname,
song.ArtistId,
song.Name AS sname,
song.Version,
label.LabelId,
label.Name AS lname
FROM maingenere
LEFT JOIN releaseprod
ON ( maingenere.MainGenreId = releaseprod.MainGenreId
AND artist.ArtistId = releaseprod.ArtistId
AND ong.ArtistId = releaseprod.ArtistId
AND label.LabelId = releaseprod.LabelI )
或
编辑您的问题并告诉我编辑我的回复
或者你的意思是
SELECT maingenere.MainGenreId,
maingenere.Name AS mname,
'saewill.mp3' AS mp3,
releaseprod.ArtistId,
releaseprod.MainGenreId,
releaseprod.LabelId,
artist.ArtistId,
artist.Name AS aname,
song.ArtistId,
song.Name AS sname,
song.Version,
label.LabelId,
label.Name AS lname
FROM maingenere
LEFT JOIN releaseprod
ON (maingenere.MainGenreId = releaseprod.MainGenreId)
LEFT JOIN artist
ON (artist.ArtistId = releaseprod.ArtistId)
LEFT JOIN song
ON (song.ArtistId = releaseprod.ArtistId)
LEFT JOIN label
ON( label.LabelId = releaseprod.LabelId)
答案 1 :(得分:0)
试试这个: -
SELECT maingenere.MainGenreId,maingenere.Name as mname,'saewill.mp3' as mp3,
releaseprod.ArtistId,releaseprod.MainGenreId,releaseprod.LabelId,artist.ArtistId,
artist.Name as aname,song.ArtistId,song.Name as sname,song.Version,label.LabelId,
label.Name as lname
FROM maingenere
left join releaseprod ON maingenere.MainGenreId = releaseprod.MainGenreId
left join artist ON artist.ArtistId = releaseprod.ArtistId
left join song ON song.ArtistId = releaseprod.ArtistId
left join label ON label.LabelId = releaseprod.LabelId;