Home > DeveloperSection > Forums > SQL Query to Find Repeat Customer
Jeet Verma
Jeet Verma

Total Post:110

Points:776
Posted on    September-22-2014 2:48 AM

 Database Database 
Ratings:


 1 Reply(s)
 1032  View(s)
Rate this:

In an [orders] table, some rows have the same value for the Customer column meaning they are repeat customers.

ProductID            Customer

111                         Mr. John

333                         Mr. Rakesh

444                         Mr. John

777                         Mr. Shiva

999                         Mr. Rakesh

What can I do to find the repeat customer instead of product id different? I get the all customer which are repeated on the basis of customer Name.



Anchal Kesharwani
Anchal Kesharwani

Total Post:10

Points:70
Posted on    September-22-2014 2:57 AM

hi jeet,

You should try to this:

SELECT Customer FROM yourTable

GROUP BY Customer

HAVING COUNT(*) > 1

 


Don't want to miss updates? Please click the below button!

Follow MindStick