Home > database >  Oracle data ranking problem
Oracle data ranking problem

Time:09-23

Some customers don't participate in the rankings, but to top

Such as: student id, scores, whether to participate in the ranking

For example, there are 200 students, 100 to participate in the ranking, 100 do not participate in the rankings, but also should record ranking position, how to write a SQL statement

CodePudding user response:

Can be as simple as a class has 100 students, has been ranked, now again to 100 students, there are one hundred students of the new inserted into the inside, before students ranked the same

CodePudding user response:

Select student id, scores, whether to participate in the ranking, rownum () over score (order by desc).so the from tab_stu t where whether to participate in the ranking='is'
Union all
Select student id, scores, whether to participate in the ranking, 'so the from tab_stu t where whether to participate in the ranking=' or '
The order by mark desc;

CodePudding user response:

What is the expected results? You must provide at least one excel painting figure come out,
  • Related