delete duplicate orders
From: ashleyT (anonymous_at_discussions.microsoft.com)
Date: 04/12/04
- Previous message: newbie k: "Re: Delete higher price record, if there is one."
- Next in thread: Vishal Parkar: "Re: delete duplicate orders"
- Reply: Vishal Parkar: "Re: delete duplicate orders"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 12 Apr 2004 07:06:04 -0700
I have an order with multiple line items. When the order comes in and put into a table I would like to check that they haven't submitted it twice. Right now I have a stored procedure that can find duplicate lines, but I really need if the whole order has been duplicated then delete it.
So in my store procedure I use:
SELECT COUNT(*) AS Amount,ItemNumber,Store,DeliveryDate,submission,Quantity
FROM tblItemOrder
GROUP BY ItemNumber,Store,DeliveryDate,submission,Quantity
HAVING COUNT(*) > 1
So this finds duplicate rows. But I need to find if the all rows are duplicated go ahead and delete.
The table structure is fields Amount,ItemNumber,Store,DeliveryDate,submission,Quantity with no primary key (working table to get the data into shape).
Even if I could find if there are the same amount of rows that have duplicates COUNT(*) > 1, then go ahead and delete the duplicates that would work fine.
- Previous message: newbie k: "Re: Delete higher price record, if there is one."
- Next in thread: Vishal Parkar: "Re: delete duplicate orders"
- Reply: Vishal Parkar: "Re: delete duplicate orders"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
- Re: Help with Duplicate Query
... If everything is same and amount is above 100, ... should these be regarderd
as duplicates: ... Best, Hugo ... (Remove _NO_ and _SPAM_ to get my
e-mail address) ... (microsoft.public.sqlserver.server) - Organizing photos
... I dumped a HUGE amount of photos and other files on a backup drive, ...
now I want to go and organize them, deleting the duplicates but I am having ...
(microsoft.public.windowsxp.photos) - Re: Help with Duplicate Query
... "Hugo Kornelis" wrote: ... >>The problem I have is with the amount
column. ... > Hi James, ... should these be regarderd as duplicates:
... (microsoft.public.sqlserver.server) - Re: Check for duplicate data
... Check out the NEWsgroup stats! ... see if there are any duplicates on
the sheet at all so column B might have ... function listed in this forum, but it is not
very efficient for the amount ... (microsoft.public.excel.worksheet.functions)