eo
MIS
- Apr 3, 2003
- 809
I have a set of data on which I perform fuzzy grouping, but only need to use the most recent of each group.
The group is based on a Business Key (SSK). I will show bwo example data
If I run a fuzzy grouping over this set, I will get a set that looks very similar as there are 3 instances of SSK 100. But I want to only use that once in the query, so would need to remove 2 of the SSK 100 records, and this is the question, how do I do this.
of course a query such as the one below would do it, but note that the DWSK is actually a uniqueidentifier, so cannot use MAX()
Any ideas?
EO
Hertfordshire, England
The group is based on a Business Key (SSK). I will show bwo example data
Code:
DWSK SSK CompanyGroupName CompanyName
001 100 A.H.L A.H.L London
002 100 A.H.L A.H.L London
003 100 A.H.L A.H.L London
004 101 AHL AHL London
005 102 HL AHL London
If I run a fuzzy grouping over this set, I will get a set that looks very similar as there are 3 instances of SSK 100. But I want to only use that once in the query, so would need to remove 2 of the SSK 100 records, and this is the question, how do I do this.
of course a query such as the one below would do it, but note that the DWSK is actually a uniqueidentifier, so cannot use MAX()
Any ideas?
Code:
select Max(DWSK)
,SSK
,CompanyGroupName
,CompanyName
from dbo.DirectCustomer
group by
SSK
,CompanyGroupName
,CompanyName
EO
Hertfordshire, England