Grouping Query Required

gvsrao's Avatar
Newbie Member
Hai Every one , Please help me in writing the query for the following requirement

Let us Suppose there is one table with two columns.

Col1 Col2
1 01-jan-07
1 01-Feb-07
1 01-mar-07
1 01-Apr-07

2 05-jan-07
2 06-Feb-07
2 07-mar-07
2 10-Apr-07

I need a query which assigns the sequnece numbers to each group. i.e. i should get the out put as follows

1 1 01-jan-07
2 1 01-Feb-07
3 1 01-mar-07
4 1 01-Apr-07


1 2 05-jan-07
2 2 06-Feb-07
3 2 07-mar-07
4 2 10-Apr-07
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Code:
Select col1, col1, col2 from table1, table1 where table1.col2 = table2.col2