[EMAIL PROTECTED] wrote:
I have a database of images, http://www.thethistlehouse.com/db.jpg

What I want to do is select ONLY ONE image to display as a the image link for 
that gallery. As you can see galleries are numbered dynamcially but galleries 
can also be added and deleted so the galleries no's I have now (7, 8) will 
change. I have the code to display the thubnail but am stuck with the query.

I want to use mysql and php to

(i) determine how many unique galleries there are.

To list the galleries:

  SELECT DISTINCT gallery FROM yourpicturetable;

To count them:

  SELECT COUNT(DISTINCT(gallery)) FROM yourpicturetable;

(ii) Retrieve & display a single thumbnail from each gallery to act as the link 
to that gallery

That should be easy, but first you must tell us how you determine which picture in each gallery is the desired thumbnail.

Michael

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to