LesStockton
Programmer
I've got a problem with getting the DISTINCT clause here working:
select Distinct(T_Contact.ContactID),
LastName, FirstName, T_Contact.ActiveInd, ContactTypeDescription,
T_ContactType.ContactTypeID, T_Organization.OrganizationID, OrganizationName,
City, State, HomePhone
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 LastName, FirstName
For some reason, I get duplicate ContactIDs. I'd like to get unique ContactIDs, which essentially give me unique first,last name.
select Distinct(T_Contact.ContactID),
LastName, FirstName, T_Contact.ActiveInd, ContactTypeDescription,
T_ContactType.ContactTypeID, T_Organization.OrganizationID, OrganizationName,
City, State, HomePhone
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 LastName, FirstName
For some reason, I get duplicate ContactIDs. I'd like to get unique ContactIDs, which essentially give me unique first,last name.