antydde att din images_videos-tabell har ett ID-fält
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)