dense_rank

1

Please login or register to vote for this query.

(click on this box to dismiss)

History of Science and Math

Q&A for people interested in the history and origins of science and mathematics

create table #temp
(
  journalSurrogateKey int,
  companyCode int,
  reportingLanguage varchar(20)
)

insert into #temp values (1, 1, 'DE')
insert into #temp values (2, 2, 'EN')
insert into #temp values (3, 2, 'EN')
insert into #temp values (4, 3, 'DE')
insert into #temp values (5, 3, 'EN')

SELECT journalSurrogateKey
     , dense_rank() OVER (
           ORDER BY companyCode
                  , reportingLanguage
       ) AS JEAdditionalAttributeSurrogateKey
     , companyCode
     , reportingLanguage
FROM #temp

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results