SELECT photo_gallery.* , assets.location AS image_location, assets.mime_type AS image_mime_type, assets.orig_name AS image_name, assets.width AS image_width, assets.height AS image_height, assets.extension AS image_ext, assets.url AS image_url FROM photo_gallery INNER JOIN assets ON assets.id = photo_gallery.image_id WHERE tree_id = 369 ORDER BY prio