I am using ASP with MS Access Database to create a photo album
there are two tables in the database tblGallery and tblPics each table has the following columns

tblGallery = [galleryID] [galleryName] [galleryDate]
tblPics = [picID] [picCat] [picName]

tblGallery.galleryID = tblPics.picCat in order to create a relational Database and have created the following query for my recordset

SELECT galleryID, picCat, galleryName, galleryDate, picID, picName FROM tblGallery INNER JOIN tblPics ON tblPics.picCat = tblGallery.galleryID

My aim now is to display the recordset in a repeating table but need to remove any records returned with the same galleryID

I have been searching for two days and although I have found a lot of similar issues which suggest using DISTINCT, GROUP BY etc... I have not yet been able to find a solution that works. I am now running out of time for my deadline so any feedback/help would be highly appreciated

9 Years
Discussion Span
Last Post by nrvinayak

The idea here is that it returns data where there is only one instance of the galleryID (doesn't matter which one) I then use this as a link to a detail page that dispalys all records for that galleryID (I have got this working fine)


If you are not going to show the details in the initial page, you can just retrieve a distinct value of galleryId and then use them to link to detail page.


SELECT distinct galleryID
FROM tblGallery INNER JOIN tblPics ON tblGallery.galleryID=tblPics.picCat;

Hope this suggestion is of help to you.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.