SELECT pictures.*, ratings.* FROM pictures, ratings WHERE ratings.picture_id = pictures.id ORDER BY ratings.rate desc