Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Get Count Of Duplicate Records Using A Loop

Get Count Of Duplicate Records Using A Loop

Scheduled Pinned Locked Moved Database
csharpcomhelp
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rowdykuttan
    wrote on last edited by
    #1

    Dear All I have a Table Named CustomerDetails where i have millions of records the table structure is as follows **RecordId CustomerName CompanyName EmailAddress Phone** Is it possible to get the EmailAddress count of specific domains like how many emails with @gmail.com, @yahoo.com, @rocketmail.com, @att.net, @verizon.net I have tried a lot of ways but i have failed in all tries , If possible drop me a line of code so it will be a great help for me Kind regards James

    T P 2 Replies Last reply
    0
    • R rowdykuttan

      Dear All I have a Table Named CustomerDetails where i have millions of records the table structure is as follows **RecordId CustomerName CompanyName EmailAddress Phone** Is it possible to get the EmailAddress count of specific domains like how many emails with @gmail.com, @yahoo.com, @rocketmail.com, @att.net, @verizon.net I have tried a lot of ways but i have failed in all tries , If possible drop me a line of code so it will be a great help for me Kind regards James

      T Offline
      T Offline
      Tim Carmichael
      wrote on last edited by
      #2

      1. What type of database? 2. If using SQLServer, consider the following: select count(*) from security_data where charindex('Test',Resource_Desc) > 0 The table and column represent my data, but you should be able to modify it to your needs. Tim

      R 1 Reply Last reply
      0
      • T Tim Carmichael

        1. What type of database? 2. If using SQLServer, consider the following: select count(*) from security_data where charindex('Test',Resource_Desc) > 0 The table and column represent my data, but you should be able to modify it to your needs. Tim

        R Offline
        R Offline
        rowdykuttan
        wrote on last edited by
        #3

        Hi tim Thank your for your reply yes am using SQL2000

        T 1 Reply Last reply
        0
        • R rowdykuttan

          Hi tim Thank your for your reply yes am using SQL2000

          T Offline
          T Offline
          Tim Carmichael
          wrote on last edited by
          #4

          You're welcome.

          R 1 Reply Last reply
          0
          • T Tim Carmichael

            You're welcome.

            R Offline
            R Offline
            rowdykuttan
            wrote on last edited by
            #5

            Hi Tim

            select count(*) from CustomerDetails where charindex('@',EmailAddress) > 0

            Here its showing total record count, i wish to get the count of emails with @gmail.com @yahoo.com, but i cannot hard code this cause the list is so big that it has to run a loop by itself Kind regards James

            T 1 Reply Last reply
            0
            • R rowdykuttan

              Hi Tim

              select count(*) from CustomerDetails where charindex('@',EmailAddress) > 0

              Here its showing total record count, i wish to get the count of emails with @gmail.com @yahoo.com, but i cannot hard code this cause the list is so big that it has to run a loop by itself Kind regards James

              T Offline
              T Offline
              Tim Carmichael
              wrote on last edited by
              #6

              Using a different table on my end... select distinct substring(email_distribution,charindex('@',email_distribution),len(email_distribution)), count(*) from bow_reports where charindex('@',email_distribution) > 0 group by substring(email_distribution,charindex('@',email_distribution),len(email_distribution)) Again, customize to your use. email_distribution should be equivalent to your emailaddress bow_reports should be equivalent to your customerdetails Tim

              R 1 Reply Last reply
              0
              • T Tim Carmichael

                Using a different table on my end... select distinct substring(email_distribution,charindex('@',email_distribution),len(email_distribution)), count(*) from bow_reports where charindex('@',email_distribution) > 0 group by substring(email_distribution,charindex('@',email_distribution),len(email_distribution)) Again, customize to your use. email_distribution should be equivalent to your emailaddress bow_reports should be equivalent to your customerdetails Tim

                R Offline
                R Offline
                rowdykuttan
                wrote on last edited by
                #7

                Dear Tim Thank you very much it worked :) Kind regards James

                1 Reply Last reply
                0
                • R rowdykuttan

                  Dear All I have a Table Named CustomerDetails where i have millions of records the table structure is as follows **RecordId CustomerName CompanyName EmailAddress Phone** Is it possible to get the EmailAddress count of specific domains like how many emails with @gmail.com, @yahoo.com, @rocketmail.com, @att.net, @verizon.net I have tried a lot of ways but i have failed in all tries , If possible drop me a line of code so it will be a great help for me Kind regards James

                  P Offline
                  P Offline
                  PIEBALDconsult
                  wrote on last edited by
                  #8

                  I would write a user-defined function that returns the domain and then group by it.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups