Hi All!
I am trying to update the existing column based ob some condition.
This is the input data :
Group | class | roll_no |
aa | a | 1 |
b | 2 | |
aa | c | 3 |
d | 4 | |
e | 5 | |
aa | f | 6 |
g | 7 | |
ac | h | 8 |
aa | i | 9 |
ac | j | 10 |
ac | k | 11 |
ac | l | 12 |
ac | m | 13 |
ac | n | 14 |
o | 15 | |
p | 16 | |
ac | q | 17 |
ac | r | 18 |
aa | s | 19 |
t | 20 | |
u | 21 | |
v | 22 | |
w | 23 | |
x | 24 |
count | group |
5 | aa |
8 | ac |
What I'm trying to get in the output is if the count of group is less than 9 , I'll assign the unassigned roll_no in ascending order to those groups.
This is how the output be like:
Group | class | roll_no |
aa | a | 1 |
aa | b | 2 |
aa | c | 3 |
aa | d | 4 |
aa | e | 5 |
aa | f | 6 |
aa | g | 7 |
ac | h | 8 |
aa | i | 9 |
ac | j | 10 |
ac | k | 11 |
ac | l | 12 |
ac | m | 13 |
ac | n | 14 |
aa | o | 15 |
ac | p | 16 |
ac | q | 17 |
ac | r | 18 |
s | 19 | |
t | 20 | |
u | 21 | |
v | 22 | |
w | 23 | |
x | 24 |
As I'm still a new learner ,this solution would be of great help ,Thanks in advance 🙂
2 questions
@Qiu
Hi,
Thanks for pointing that out, I have corrected the output what I want ,
Also, I'm trying to first assign based on roll_no.
For example : if roll_no 20 is not assigned roll_no 21 cannot be assigned .
The count of groups should not be more than 9,the unassigned ones are hence left blank.
Something does not add up to me yet.
Anyway, I interpret less than 9 meaning only 9 count can be assigned from top, so only 4 ac can be assigned.
User | Count |
---|---|
106 | |
82 | |
70 | |
54 | |
40 |