I have 2 tables, the first one is ITEMS and the other is GALLERY (where I have the images of every item), these 2 tables are related by item\_id = item\_gal\_id.

In these 2 tables there are 2 important fields, item\_order (in ITEMS) and img\_order (in GALLERY) which I use to order the items and the images by drag & drop.

I have no problem to order and output the items in the home page with this query:

```
SELECT * 
FROM items a 
LEFT JOIN gallery b ON (a.item_id = b.item_gal_id) 
WHERE a.it_public='SI' 
GROUP BY a.item_id, b.item_gal_id 
ORDER BY a.item_order ASC

```

BUT...every item shows 1 (ONE) image in the home page and that image is not the one suposed to be, I mean that I can't output the image that is in the first place of the GALLERY order...

When I hit in one of the items to go to the detail page is easy to show the images in the order I want by using this query:

```
SELECT * 
FROM gallery 
WHERE item_gal_id = (the item_id I send by GET) 
ORDER BY img_order ASC

```

So, how can I show a list of items ordered by item\_order and, in the same query, to show the image that is the first for that item having img\_order, is there a way to do this?

I've been searching and reading for 2 days with no luck, trying several options but I'm really stack with this.