Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Help to remove Duplicates using Stored Procedure?

Author  Topic 

roxcy
Yak Posting Veteran

58 Posts

Posted - 2006-10-05 : 09:33:34
hi,
I am using storedprocedure where I would like to remove duplicate values.as well I would like to Count the No of Duplicates.Below is my code.


SELECT BRANCH,COUNT(DISTINCT BRANCH), SUM(CASE WHEN NOOFDAYSLOS BETWEEN 7 AND 30 THEN 1 ELSE 0 END)'Over a week',
SUM(CASE WHEN NOOFDAYSLOS BETWEEN 30 AND 90 THEN 1 ELSE 0 END)'Over 30 Days',
SUM(CASE WHEN NOOFDAYSLOS BETWEEN 91 AND 180 THEN 1 ELSE 0 END)'Over 90 Days'

FROM DETAILS
WHERE DATERECEIVED BETWEEN @FromDate AND @ToDate and STATUS = 'C'
GROUP BY BRANCH,DATERECEIVED
ORDER BY BRANCH

I tried using the above code but it did'nt work out.

Plz Can SomeOne Find an Appropriate Solution.
Thanks In Advance..

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-10-05 : 09:38:00
[code]GROUP BY BRANCH, DATERECEIVED[/code]


KH

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-05 : 11:28:45
or post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -