|
View previous topic :: View next topic
|
| Author |
Message |
ssowmya
New User

Joined: 10 Oct 2006 Posts: 40
|
|
|
|
Hi
I need to do the foll...I have a table TABLE1 with foll columns
| Code: |
Name Seq
---------------
N1 1
N2 1
N2 1
N3 1
N3 1
N3 1
N3 1 |
Where Seq is populated with '1' initially. I should update the table so that the seq number is incremented for the same name...That is...the resultant table should be
| Code: |
Name Seq
---------------
N1 1
N2 1
N2 2
N3 1
N3 2
N3 3
N3 4 |
Could anyone pls help.... |
|
| Back to top |
|
 |
raghunathns
Active User
.jpg)
Joined: 08 Dec 2005 Posts: 127 Location: rochester
|
|
|
|
try like this.
| Code: |
UPDATE TABLE1 A
SET COL2 = ( SELECT COUNT(*)
FROM TABLE1 B
WHERE A.COL1 = B.COL1
AND B.COL2 = 1) |
------------
| Code: |
| select * from table1 order by col1, col2. |
you will get the result. |
|
| Back to top |
|
 |
|
|