Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

php mssql

I have a select query that pulls data
but some time the record is duplicated
E.g
expr2   name          date
123      beridius      10/10/2012
123      beridius      10/10/2012
122      smith           09/10/2012


how would I count the number of duplicates?
0
beridius
Asked:
beridius
1 Solution
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
to start with, this would give you all the info for which you have duplicates:
select expr2, name, date, count(*)
  from yourtable
group by expr2, name, date
having count(*) > 1 

Open in new window


is that what you want?
see also this article:
http://www.experts-exchange.com/Database/Miscellaneous/A_3203-DISTINCT-vs-GROUP-BY-and-why-does-it-not-work-for-my-query.html
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now