943,696 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Unsolved
  • Views: 2308
  • ASP RSS
Jan 9th, 2009
0

Need a Distinct Column in my inner join statement

Expand Post »
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

ASP Syntax (Toggle Plain Text)
  1. 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
Cheers
Kaden712
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kaden712 is offline Offline
5 posts
since Jan 2009
Jan 9th, 2009
0

Re: Need a Distinct Column in my inner join statement

What are you trying to do?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
hhamdan is offline Offline
21 posts
since Nov 2008
Jan 9th, 2009
0

Re: Need a Distinct Column in my inner join statement

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)
Cheers
Kaden712
Reputation Points: 10
Solved Threads: 0
Newbie Poster
kaden712 is offline Offline
5 posts
since Jan 2009
Jan 12th, 2009
0

Re: Need a Distinct Column in my inner join statement

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.

eg.

sql Syntax (Toggle Plain Text)
  1. SELECT DISTINCT galleryID
  2. FROM tblGallery INNER JOIN tblPics ON tblGallery.galleryID=tblPics.picCat;

Hope this suggestion is of help to you.
Last edited by peter_budo; Jan 13th, 2009 at 5:44 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
nrvinayak is offline Offline
7 posts
since Jul 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: Concurrency checks
Next Thread in ASP Forum Timeline: How to place a sql query in a javascript in an asp page





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC