Let’s say I have a SQL table like this:
UniqueID Word
1 apple
2 orange
3 banana
4 apple
I want to create a hash key as an integer. That integer should map to a particular word. So that the key has some meaning, I’d like the number to be the UniqueID of the first occurance of word. Which means I’d like to generate a table like this:
Unique ID Word WordHash
1 apple 1
2 orange 2
3 banana 3
4 apple 1
I tried using a group by statement, along with min(unique id), but that gets rid of the last apple row. I’d like to keep that row.
1 Answer