Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 6th, 2006, 04:48 PM
Registered User
 
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DISTINCT trouble

I've built a database that creates the following query, which works fine, except that I don't get unique ContactIDs.

select Distinct(T_Contact.ContactID),
LastName, FirstName, T_Contact.ActiveInd, ContactTypeDescription,
T_ContactType.ContactTypeID, T_Organization.OrganizationID, OrganizationName
from
T_Contact
join T_ContactTypeContact on T_Contact.ContactID = T_ContactTypeContact.ContactID
join T_ContactType on T_ContactTypeContact.ContactTypeID = T_ContactType.ContactTypeID
join T_OrganizationContact on T_Contact.ContactID = T_OrganizationContact.ContactID
join T_Organization on T_OrganizationContact.OrganizationID = T_Organization.OrganizationID
where 1=1
     AND (T_Contact.ActiveInd = 1)
  AND (T_Contact.OwnerCompany = 1) ORDER BY T_Contact.ContactID



 
Old March 7th, 2006, 01:07 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

DISTINCT won't always give you unique values. It will give you unique values for each of the other parameters in your query. What exactly are you going to do with the unique contact IDs?






Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Distinct Smeghead SQL Server 2005 9 December 17th, 2007 11:10 AM
Distinct Eddywardo SQL Server 2005 1 September 2nd, 2006 07:41 AM
Select Distinct? hugh@kmcnetwork.com SQL Language 5 November 5th, 2005 09:58 AM
Distinct data arnabghosh Access 2 September 21st, 2005 10:46 AM
Distinct SELECT DISTINCT question... EndEffect Classic ASP Databases 4 August 18th, 2005 08:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.