Wednesday, March 21, 2012

Number of duplicate record

I need help writing a query that can tell me the number of records with the
same content.
For example, this is my database (Data1 only has 1 column)
Table Data1
Column numbers
234
322
2323
234
453
234
412
2323
the query should like something like this
Select ..... From Data1 Where ... numbers =..
if i use
Select ..... From Data1 Where ... numbers = 234
it would return 3, because there are 3 234s in the column
Thanks in Advance,
AaronHi Aaron,
You could try
Select count(*) from Data1 Where Numbers = 234
HTH
Barry|||Select count(*) From Data1 Where numbers = 234
"Aaron" <kuya789@.yahoo.com> wrote in message
news:%23$tXt9cHFHA.1392@.TK2MSFTNGP10.phx.gbl...
> I need help writing a query that can tell me the number of records with
the
> same content.
> For example, this is my database (Data1 only has 1 column)
> Table Data1
> Column numbers
> 234
> 322
> 2323
> 234
> 453
> 234
> 412
> 2323
> --
> the query should like something like this
> Select ..... From Data1 Where ... numbers =..
> if i use
> Select ..... From Data1 Where ... numbers = 234
> it would return 3, because there are 3 234s in the column
>
> Thanks in Advance,
> Aaron
>|||Aaron,
If you want count the duplicate Records for the whole table rather than
individually then use:
select count(*), Numbers
>From Data1
Group By Numbers
Having Count(Numbers) > 1
HTH
Barry|||thanks.
"Barry" <barry.oconnor@.singers.co.im> wrote in message
news:1109683340.054164.176760@.g14g2000cwa.googlegroups.com...
> Aaron,
> If you want count the duplicate Records for the whole table rather than
> individually then use:
> select count(*), Numbers
> Group By Numbers
> Having Count(Numbers) > 1
> HTH
> Barry
>

No comments:

Post a Comment