Re: display a single thumb per gallery

From: Date: Sun, 27 Aug 2006 21:31:37 +0000
Subject: Re: display a single thumb per gallery
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-241149@lists.php.net to get a copy of this message
Here is one way of doing it: Group by gallery and return max for image id. Place the resultant Gallery and Image values in an array of arrays. SELECT Gallery, Max(Image) FROM Thumbnails GROUP BY Gallery Then loop over the outer array returning the entire thumbnail row where gallery and image match the values in the inner array SELECT * FROM Thumbnails WHERE Gallery=XXX AND Image=XXX This all assumes there is a column called Image that uniquely identifies each row - if there is not - errr. Cheers AJ Dave Goodchild wrote:
To find out how many unique galleries: SELECT DISTINCT gallery FROM table
Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- www.deployview.com www.nerds-central.com www.project-network.com

« previous php.general (#241149) next »