underforstået, at din images_videos-tabel har et ID-felt
SELECT *
FROM gallery g1
LEFT JOIN images_videos iv1
ON g1.id = iv1.gallery_id
WHERE gallery.user_id = "+another_userid+"
AND iv1.id = (SELECT Max(id)
FROM images_videos iv2
WHERE iv1.gallery_id = iv2.gallery_id)