Question

I have the following data

FieldA   FieldB      FieldC   FieldD
1234     01/05/14    Mark     John
3234     05/04/2014  Mark     Smith
3232     05/09/2013  Kara     Sidney
3554     06/08/2012  Lamar    Angela
5668     01/01/2011  Kara     Rick

I have 15 Million Similar records in a data set. I would like to create a query that would give unique numbers to "Mark, Kara, Lamar" whenever they appear to be their unique number.

FieldA   FieldB      FieldC   FieldD   FieldE 
1234     01/05/14    Mark     John       1
3234     05/04/2014  Mark     Smith      1
3232     05/09/2013  Kara     Sidney     2
3554     06/08/2012  Lamar    Angela     3
5668     01/01/2011  Kara     Rick       2

how can I do that?

Was it helpful?

Solution

If you really want to get crazy, here's a solution:

SELECT [FieldA], [FieldB], a.[FieldC], [FieldD], [FieldE]
FROM [TABLE] a
LEFT JOIN(
SELECT DISTINCT [FieldC], pwdencrypt([FieldC]) as [FieldE]
FROM [TABLE]) b
ON a.[FieldC] = b.[FieldC]

That pwdencrypt() creates a very unique id.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top