TariqMehmod
Programmer
Sir I have these codes
[pre]
CREATE CURSOR junk(qty n(3),idid n(3))
INSERT INTO junk values(5,1)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
INSERT INTO junk values(0,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
[/pre]
I want to fill idid column as follows
Logic:
Qty increase then decrease in every idid group.
New idid starts from small to bigger number like shown with red color.
Please
[pre]
CREATE CURSOR junk(qty n(3),idid n(3))
INSERT INTO junk values(5,1)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
INSERT INTO junk values(0,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(20,0)
INSERT INTO junk values(15,0)
INSERT INTO junk values(10,0)
INSERT INTO junk values(5,0)
[/pre]
I want to fill idid column as follows
Logic:
Qty increase then decrease in every idid group.
New idid starts from small to bigger number like shown with red color.
Please