Results 1 to 2 of 2

Thread: Select Distinct

  1. #1
    AAA Guest

    Select Distinct


    Can I run Select distinct on one fieldname only while I'm selecting more than one fielname, like

    Select Distinct col1, col2, col3 from table

    I need distinct on col1 only and not on the other 2 columns, is it possible.

    Thanks

  2. #2
    Ananth Guest

    Select Distinct (reply)


    Distinct means DISTINCT across all selected columns. If you want distinct on one column, then you need to know how to handle the duplicates on the other columns...you have to use an aggregate function like

    select col1, MAX(col2), MIN(col3), AVG(Col4) -- any you prefer
    from table
    group by col1


    ------------
    AAA at 6/25/01 10:56:01 AM


    Can I run Select distinct on one fieldname only while I'm selecting more than one fielname, like

    Select Distinct col1, col2, col3 from table

    I need distinct on col1 only and not on the other 2 columns, is it possible.

    Thanks

Posting Permissions

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