Hello,
I'm trying to get all contents with images for section 2, but for one 'id' from 'entry' there should be only one image from 'images' with the lowest 'number'
As you can see for id=11 there are two images, but I want to get only this with id=28, because it has the lowest number.
Id 'photos' identifies images from HD.
Tables.
'entry'
'images'Code:id | number | content| vis| section 11 2 op1 1 2 14 1 op2 0 2 15 3 op3 1 2
I was trying with this query, using group by i.id_entry , but i don't know how to sort images by number too.Code:id | id_entry | number | vis| 21 11 2 1 22 15 1 1 23 14 1 1 28 11 1 1
Code:SELECT i.`id`, i.`vis`, e.`content` FROM `images` AS i JOIN `entry` AS e ON e.`id` = i.`id_entry` WHERE e.`section` = 2 AND e.`vis` = 1 GROUP BY i.`id_entry` ORDER BY e.`number` ASC







Bookmarks