我有一个查询,左连接部分应该返回数据或 null。但即使有现有记录,它也不会返回任何数据。左连接部分的转折是我只想检索一条记录(如果存在)。谢谢你的帮助。
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