Results 1 to 2 of 2

Thread: Double ups and SQL

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2000
    Location
    Perth Western Australia
    Posts
    41
    Use the DISTINCT or DISTINCTROW command in you SELECT SQL statement.

    The DISTINCT clause is used to remove duplicate records from the resulting data set. i.e. "SELECT DISTINCT MyName FROM tblNames"
    This will return one entry for each MyName that exists, so if there are two or more "Colin's" in your table it will only show one thus........

    MyName MyLastName Age
    Colin Green Old
    Colin Green Old
    Colin Green 35
    Peter Paul 41

    Will return
    MyName
    Colin
    Peter

    The DISTINCTROW clause is used to select data that is distinct in any of the fields. i.e. "SELECT DISTINCTROW * FROM tblNames"
    This will return one entry for each non duplicate record that, so if there are two or more "Colin's" in your table it will return any unique records thus.............

    MyName MyLastName Age
    Colin Green Old
    Colin Green 35
    Peter Paul 41


    Hope this helps!


  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105
    Distinctrow is, I believe, a Jet "enhancement" to SQL. You cannot use that keyword in SQL Server 6.5 or Sybase, for example.

Posting Permissions

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



Click Here to Expand Forum to Full Width