Question
GROUP BY clause not working coherently
hi:
i have this master page listing some shops with a thumbnail and some data:
http://www.fashiontraveler.com/newsite/sdct_shoplst.php?m=12&brand=242&country=150&city=2406
if you click in the "see more +" link a detail page is loaded showing
more photos and data
the problem is the client wants the thumbnail in the master page to be
the first photo introduced (that with lower id_photo) as listed in the
detail page
i'd say the GROUP BY clause should always return the last photo
corresponding to a shop but as you can see, the first 2 shops show the
last and the other 3 show the first photo as thumbnail!?
"SELECT shops.id_shop,name,address,zip,phone,text,photos_shop.photo
FROM shops
LEFT JOIN photos_shop ON shops.id_shop = photos_shop.id_shop
GROUP BY shops.id_shop
ORDER BY name";
tia,
jdoe
i have this master page listing some shops with a thumbnail and some data:
http://www.fashiontraveler.com/newsite/sdct_shoplst.php?m=12&brand=242&country=150&city=2406
if you click in the "see more +" link a detail page is loaded showing
more photos and data
the problem is the client wants the thumbnail in the master page to be
the first photo introduced (that with lower id_photo) as listed in the
detail page
i'd say the GROUP BY clause should always return the last photo
corresponding to a shop but as you can see, the first 2 shops show the
last and the other 3 show the first photo as thumbnail!?
"SELECT shops.id_shop,name,address,zip,phone,text,photos_shop.photo
FROM shops
LEFT JOIN photos_shop ON shops.id_shop = photos_shop.id_shop
GROUP BY shops.id_shop
ORDER BY name";
tia,
jdoe
