SELECT ID, OTHER_ID, DATE_VALUE, ROW_NUMBER() OVER (PARTITION BY OTHER_ID ORDER BY DATA_VALUE desc) R,COUNT(*) OVER (PARTITION BY OTHER_ID) FROM SOME_TABLE
**Row_Number gives the row number of the row in a table after partition by other_id**Count(*) gives the count value of the rows partitioned by other_id
No comments:
Post a Comment