Selecting Distinct records

Results 1 to 3 of 3

Thread: Selecting Distinct records

  1. #1
    Snoop Guest

    Default Selecting Distinct records

    I have an Access database. I want to select distinct records from a table. I used this query:<BR><BR>Select Distinct(CompanyName), FirstName, Last Name, etc...FROM<BR>CompanyTable<BR><BR>but it returns all the rows<BR><BR>So I tried this:<BR><BR>Select CompanyName, FirstName, LastName, etc....FROM CompanyTable<BR>WHERE CompanyName IN (SELCT DISTINCT(CompanyName) FROM CompanyTable). Still returns all the rows.<BR><BR>Is there something that Access doesn&#039;t like about the Distinct when other data field are in the query.<BR><BR>Inquiring minds want to know.

  2. #2
    Join Date
    Dec 1969

    Default ???

    I don&#039;t see the relationship. Would CompanyName be a many to one relationship with FirstName, LastName, etc or the other way around? I am guessing that you only want to return ONE person&#039;s information for a specific company? If you data looks like this<BR><BR>CompanyName, FirstName, LastName<BR>ABC Inc., Jon, Doe<BR>ABC Inc., Jane, Doe<BR>XYZ Inc., Jon, Doe<BR><BR>The first to records are distinct because the FirstName fields are different.

  3. #3
    Snoop Guest

    Default RE: ???

    Yes Company Name would be same for some records, while the Contact names would be different. I am using the Distinct keyword incorrectlly?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts