Re: display a single thumb per gallery

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux