SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old April 14th, 2004, 03:48 PM
f00l f00l is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 f00l User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry displaying unique records....

hello all.
thanks in advance for any help provided.

I have an access db with 3 fields.
Id, TitleName and LinkName.

Info in the db is like..

id TitleName LinkName
-----------------------------
1 Jack Link1
2 Jack Link2
3 Bob Link1
4 Bob Link2
5 Bob Link3


What i want to display..

id TitleName LinkName
-----------------------------
1 Jack Link1
3 Bob Link1

I've tried using DISTINCT with no luck. I realize I can't use distinct on a unique cloumn like ID.

any ideas?

Maybe I could count the records and filter any 'where Count(titleName) < 2' ?

doh, if I had any hair I would pull it out.

many thanks.
f00l

Reply With Quote
  #2  
Old April 14th, 2004, 04:47 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,776 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 27 m 42 sec
Reputation Power: 470
If that is the way your table is setup, you can't get that information in a single query.
Instead of having it like this (which violates Normal Form rules of database creation, because you have duplicate data withing a table)
Quote:
id TitleName LinkName
-----------------------------
1 Jack Link1
2 Jack Link2
3 Bob Link1
4 Bob Link2
5 Bob Link3

Why don't you set it up like this
Code:
id    Titlename      LinkName1      LinkName2      LinkName3
1      Jack          Link1          Link2
2      Bob           Link1          Link2          Link3

This way you don't have duplicated data.

Reply With Quote
  #3  
Old April 14th, 2004, 05:07 PM
f00l f00l is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 2 f00l User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks but....

the LinkName column is NOT unique info.

i used link1, link2 as an example as I will be sorting by TitleName, LinkName ASC

If I were to convert the DB to your described methed, would I not be at the same place I am now?

In your new db layout, how would I extract all records without duplicate TitleNames and still have access to the ID and LinkName columns?

thanks!

Reply With Quote
  #4  
Old April 16th, 2004, 05:19 AM
Mr Pooh Mr Pooh is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 398 Mr Pooh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
you could iterate thru the returned recordset & compare titlename with the previous records titlename & ignore if the same.

Reply With Quote
  #5  
Old April 16th, 2004, 08:36 AM
DRMike DRMike is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 1 DRMike User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try this link as I think it will help you

http://www.utteraccess.com/forums/showflat.php?Cat=&Number=394515

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > displaying unique records....


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT