Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2004
    Posts
    24

    Unanswered: Count(disticnt(col1,col2,col3))

    Hi,

    When I do a count(distinct(col1)) from table1 I am getting correct result.
    But what I want is count(distinct col1,col2,col3) from table1 where col1, col2 & col3 are composite primary key.

    When I do distinct(col1,col2,col3) I am getting all the records displayed, I just want the count.

    If any one can tell me the query for this that will be a great help.
    Thanks in advacne

    Srinivas
    Thanks
    Srinivas chityala

  2. #2
    Join Date
    Jun 2003
    Posts
    140

    Re: Count(disticnt(col1,col2,col3))

    Try this

    SELECT count (distinct col1),count (distinct col2),count (distinct col3)
    FROM table1

  3. #3
    Join Date
    Feb 2004
    Location
    India
    Posts
    12
    Try this:

    select count(distinct convert(char,col1)+convert(char,col2)+convert(char (col3)) from table1

    Pat

Posting Permissions

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