Selecting Distinct field and row num just to display an id number gives duplicated data

前端 未结 3 1199
孤城傲影
孤城傲影 2021-01-27 06:07

I have a table application and it has 10 columns. category is one column and this column has duplicated values. To get distinct values I have a query

SELECT distinc

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 07:01

    Try using this

    SELECT DISTINCT(CATEGORY) AS CategoryName, 
           ROW_NUMBER() OVER (ORDER BY CATEGORY) AS categoryId
    FROM APPLICATION 
    WHERE applications =? 
    

提交回复
热议问题