none
How to find columns having same value more than 10 times?

Answers

  • You may try the below: If you have further question, please provide us your table structure, so that we will be able to help you better.

    ;with cte
    as
    (
    	Select *,count(col2)Over(partition by Col1,Col2 ) Rn
    	From Test_Nov19th_1
    ) Select * From cte where Rn>10


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Tuesday, November 19, 2013 8:49 AM

All replies

  • You may try the below: If you have further question, please provide us your table structure, so that we will be able to help you better.

    ;with cte
    as
    (
    	Select *,count(col2)Over(partition by Col1,Col2 ) Rn
    	From Test_Nov19th_1
    ) Select * From cte where Rn>10


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Tuesday, November 19, 2013 8:49 AM
  • Is any other simple query to find?
    Wednesday, November 20, 2013 6:07 AM
  • Its strange that the above one is finding complex.

    If you have only one column, then you can try the below or you need to query the actual table again to get the complete column list with the following.

    Select Col1 From test_job Group by Col1 having COUNT(col1)>10


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Wednesday, November 20, 2013 6:13 AM
  • Mr.Latheesh ,Your First Query is not working while merging to tables can u give example for  finding columns having same value more than 10 times in two tables merging with primary key.

    haaa? I want to give you example for your scenario? May be I am at wrong place here. 

    We would be able to help you if you can provide your sample scenario,which is more appropriate.


    Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.

    Thursday, November 21, 2013 5:19 AM