|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Wanted SlNo for different name.....
I've a query like below (i'm using oracle)
Select Name, Sal From (Select 'A' Name, 1 Sal From Dual Union Select 'A' Name, 2 Sal From Dual Union Select 'A' Name, 3 Sal From Dual Union Select 'B' Name, 11 Sal From Dual Union Select 'C' Name, 111 Sal From Dual Union Select 'C' Name, 222 Sal From Dual Union Select 'D' Name, 1111 Sal From Dual Union Select 'D' Name, 2222 Sal From Dual Union Select 'D' Name, 3333 Sal From Dual Union Select 'D' Name, 4444 Sal From Dual Union Select 'D' Name, 5555 Sal From Dual) which will return output like Name SAL ---- ---------- A 1 A 2 A 3 B 11 C 111 C 222 D 1111 D 2222 D 3333 D 4444 D 5555 I want one more column which will display no. for each name like No Name SAL -- ---- ---------- 1 A 1 1 A 2 1 A 3 2 B 11 3 C 111 3 C 222 4 D 1111 4 D 2222 4 D 3333 4 D 4444 4 D 5555 can anyone help me thanx in advance vijay |
|
#2
|
|||
|
|||
|
Hey,
When u r doing so much creating each column in the dual table n all, why don't u add one more column with the values wanted!!!! Or u want any other solution.. |
|
#3
|
|||
|
|||
|
hi,
that query is just example and just to explain, and i'm not using dual table in actual query, i wanted to generate those nos. dynamically thx vijay |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Wanted SlNo for different name..... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|