Subqueries for each result or inner join with php loop or …?
问题 I want to display in users search results also their photos. Not only avatar photo but 3 photos. Photos are in extra table user_photos. If I would get single row per user the answer would be clear - inner join. But I will get multirows for each user. First method I can use is join: SELECT * FROM users INNER JOIN photos ON photos.user_id=users.user_id In this case I need some extra php code to merge results with same user_id. Something like this: foreach($results as $result){ if(isset($user[