Hello,
I have a Table as follows:
-- INSERTING into TABLE1
Insert into TABLE1 (COL1,COL2,COL3) values (2,14,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,11,'Item2');
Insert into TABLE1 (COL1,COL2,COL3) values (2,1,'Item3');
Insert into TABLE1 (COL1,COL2,COL3) values (2,23,'Item11');
Insert into TABLE1 (COL1,COL2,COL3) values (2,16,'Item3');
Insert into TABLE1 (COL1,COL2,COL3) values (2,24,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,54,'Item3');
Insert into TABLE1 (COL1,COL2,COL3) values (2,6,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,9,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,5,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,7,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (2,3,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (3,23,'Item11');
Insert into TABLE1 (COL1,COL2,COL3) values (3,6,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (3,7,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (3,8,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (3,9,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,8,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,9,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,5,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,9,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,9,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (4,3,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (5,2,'Item1');
Insert into TABLE1 (COL1,COL2,COL3) values (5,7,'Item1');
I want the 10th Row for each type in Col1
i.e.,
For type 2---> the 10th row is
2 5 Item1
For type 3--> there is no 10th row so it should return me the maximum row i.e.,5th row
3 9 Item1
For type 4-->also there is no 10th row so it should return 6th row
4 3 Item1
For type 5--> also there is no 10th row so it should return 2nd row
5 7 Item1
How can i achieve this in query..Anybody please help..