Skip to content

Tag: sql

Rank based on cumulative value

I want to rank on ID and value columns based on ascending order of UID. Expected output has to change once value column has a different value than the previous value. Ranks has to restart on each new ID Here is a sample dataset that I have created: Answer I think that the simplest approach to this gaps-and-is…

Creating required script

My question is about select statement. I have a table called test1 and the values in it. Here my script for creating the table, and inserting values: create table test1(id number, pc number, pe number)…