robert030975
MIS
- Oct 17, 2006
- 227
I'll be here sometime removing this line by line if anyone could help come up a different way PLEASE!!
-- list of dups
SELECT store, purId, week, COUNT(*) AS countdup
FROM dbo.f_purchase
GROUP BY store, purID, week
HAVING (COUNT(*) > 1)
order by purID, week, store
- set var
Declare @store as varchar(4), @week as varchar(4), @cid as varchar(2), @uid as int
set @store = 'B673'
Set @week = '2406'
Set @cid = '1'
set @uid = 325004
Select * from dbo.f_purchase
where store = @store AND week = @week and purID = @cid
Delete from f.purchase
where store = @store AND week = @week and purID = @cid AND uid > @uid
-- list of dups
SELECT store, purId, week, COUNT(*) AS countdup
FROM dbo.f_purchase
GROUP BY store, purID, week
HAVING (COUNT(*) > 1)
order by purID, week, store
- set var
Declare @store as varchar(4), @week as varchar(4), @cid as varchar(2), @uid as int
set @store = 'B673'
Set @week = '2406'
Set @cid = '1'
set @uid = 325004
Select * from dbo.f_purchase
where store = @store AND week = @week and purID = @cid
Delete from f.purchase
where store = @store AND week = @week and purID = @cid AND uid > @uid