find Duplicate records

find Duplicate records

am 11.01.2006 03:19:27 von Peter Lewis

Hi

I'm trying to run a statement that finds duplicated records
in a table.
I need to test the following fields are the same and return
these ALL records that have a count of >1

date, orderno, store, storename, dnote, status, product, description, ord,
del, brand, supplier, timestamp

I have tried the following but it didn't work?

SELECT *
FROM table_name
GROUP BY *
HAVING ( COUNT(*) > 1 )

Any help?

Brian

Re: find Duplicate records

am 11.01.2006 05:06:12 von Jim Michaels

I have heard from other posts here something about the SQL standard that
doesn't allow using * in the SELECT when you are using GROUP BY. try doing
it the hard way.
"Brian" wrote in message
news:PWZwf.37397$5v1.657@newsfe2-win.ntli.net...
> Hi
>
> I'm trying to run a statement that finds duplicated records
> in a table.
> I need to test the following fields are the same and return
> these ALL records that have a count of >1
>
> date, orderno, store, storename, dnote, status, product, description, ord,
> del, brand, supplier, timestamp
>
> I have tried the following but it didn't work?
>
> SELECT *
> FROM table_name
> GROUP BY *
> HAVING ( COUNT(*) > 1 )
>
> Any help?
>
> Brian
>
>
>

Re: find Duplicate records

am 11.01.2006 11:34:48 von Stefan Rybacki

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Brian wrote:
> Hi
>
> I'm trying to run a statement that finds duplicated records
> in a table.
> I need to test the following fields are the same and return
> these ALL records that have a count of >1
>
> date, orderno, store, storename, dnote, status, product, description, ord,
> del, brand, supplier, timestamp
>
> I have tried the following but it didn't work?
>
> SELECT *
> FROM table_name
> GROUP BY *

you have to name each column in the group by clause.

Regards
Stefan

> HAVING ( COUNT(*) > 1 )
>
> Any help?
>
> Brian
>
>
>

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1rc2 (MingW32)

iD8DBQFDxN9IyeCLzp/JKjARAjSuAJ9ys9iFgsnaFGPXZ2Dj+UuPFviM2ACg oT6U
tqvbYPyKBC/l3hxoMILel/c=
=jIRe
-----END PGP SIGNATURE-----