I have two mysql tables called users and images. Every user have up to 5 pictures. In a page I show user information plus all images.
When I do query like this
SELECT
SQL_CALC_FOUND_ROWS,
u.username,
u.gender,
u.etc
.........
i.picture
FROM users u
LEFT JOIN images i on u.id = i.id
WHERE
some_condition
The result is repeating user information for every image.
For example
- userX age19 pic 1
- userX age19 pic 2
- userX age19 pic 3
- etc..
How to do so the result to be user information with all images which belongs to him ?
For example:
username
age
sex
pic1, pic2, pic3
etc.
1 Answer