filtering duplicate fields with unique rows

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • google@digiinsider.com

    #1

    filtering duplicate fields with unique rows

    I have a query that outputs the following,

    A | Name1 | Date1
    A | Name2 | Date2
    B | Name1 | Date1
    B | Name2 | Date2

    I would like to see,

    A | Name1 | Date1
    B | Name1 | Date1

    In some cases, there could be more than 2 duplicates for the first
    column field.

    I would just like the first row of each duplicate field found in column
    1.

    Please advise as to the SQL Syntax I may be able to use to complete
    this.

    Thanks in advance.

  • Randy Harris

    #2
    Re: filtering duplicate fields with unique rows

    On 5 Sep 2006 08:39:45 -0700, google@digiinsi der.com wrote:
    >I have a query that outputs the following,
    >
    >A | Name1 | Date1
    >A | Name2 | Date2
    >B | Name1 | Date1
    >B | Name2 | Date2
    >
    >I would like to see,
    >
    >A | Name1 | Date1
    >B | Name1 | Date1
    >
    >In some cases, there could be more than 2 duplicates for the first
    >column field.
    >
    >I would just like the first row of each duplicate field found in column
    >1.
    >
    >Please advise as to the SQL Syntax I may be able to use to complete
    >this.
    >
    >Thanks in advance.
    What you need is an aggregate query.

    Select
    Category,
    First(NameField ) AS NameField,
    Max(DateField) AS DateField
    From
    MyTable
    Group By
    Category

    HTH,
    Randy

    Comment

    • pGwtech

      #3
      Re: filtering duplicate fields with unique rows

      Thanks Randy. Found this on Microsoft's site,



      Similar to what you are talking about.

      Comment

      Working...