Selecting Distinct field and row num just to display an id number gives duplicated data
问题 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 distinct(CATEGORY) as CategoryName FROM APPLICATION where applicationId=? . I am getting result without any issue. Here now I wanted to add a another column as categoryId. There is no such field, I have to generate one. I tried with below query. SELECT distinct(CATEGORY) as CategoryName , rownum as categoryId FROM APPLICATION where