Thursday, March 29, 2012

Finding duplicates

I wanted to know if there was anyway to pick out duplicates in a certain day
.
Days are setup as a settlement_batch_number.
So on a certain settlement_batch_number is there a way to pick out
duplicates when
store number , card number , and amount are all the same.
Does a group by function accomplish this? Any help would be appreciated.
Thanks.SELECT settlement_batch_number, store_number, card_number, amount
FROM YourTable
GROUP BY settlement_batch_number, store_number, card_number, amount
HAVING COUNT(*)>1
--
David Portas
SQL Server MVP
--|||If I just wanted to specify a certain settlement_batch_number where would I
place that in the statement. Like say 784 was a settlement_batch_number I
wanted where would I put that in the statement. Thanks
"David Portas" wrote:

> SELECT settlement_batch_number, store_number, card_number, amount
> FROM YourTable
> GROUP BY settlement_batch_number, store_number, card_number, amount
> HAVING COUNT(*)>1
> --
> David Portas
> SQL Server MVP
> --
>|||On Mon, 7 Feb 2005 08:37:05 -0800, tarheels4025 wrote:

>If I just wanted to specify a certain settlement_batch_number where would I
>place that in the statement. Like say 784 was a settlement_batch_number I
>wanted where would I put that in the statement. Thanks
Hi tarheels4025,
SELECT settlement_batch_number, store_number, card_number, amount
FROM YourTable
WHERE settlement_batch_number = 784
GROUP BY settlement_batch_number, store_number, card_number, amount
HAVING COUNT(*) > 1
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

No comments:

Post a Comment