0
我有一個查詢,左連接的一部分要麼返回數據或空。但即使有現有記錄,它也不會返回任何數據。左連接部分的扭曲是我只想檢索一條記錄(如果存在)。謝謝你的幫助。MySQL查詢不recieving我左邊的任何數據連接
select a.*,p.thumbnailphotopath as AlbumPicture
from (select * from album_access) ac
inner join (select * from albums) a on a.ID = ac.AlbumID
left join (
select * from photos
where IsProcessed = 1 order by DateUploaded desc limit 1
) p
on a.ID = p.AlbumID #should return one if exist.
where ac.AccessUserID = '35e44a8e-643a-4c4f-8a46-59911a1e7c53'
and ac.FullControl = 1 and a.Private = 1
謝謝這個工作,我不明白你是如何得到它返回只有一個值?是MAx關鍵字? – user516883 2012-04-19 18:58:36
再次感謝您的幫助 – user516883 2012-04-19 19:13:49