hai ,
CREATE TABLE KS_EMP ( EMPLOYEE VARCHAR2(20) ,
LOCATION VARCHAR2(20) );
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'Tom ', 'UK');
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'James', 'UK');
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'Simon ', 'UK');
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'Bill', 'France');
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'Edward', 'France');
INSERT INTO KS_EMP ( EMPLOYEE, LOCATION ) VALUES ( 'Chris ', 'France');
COMMIT;
select EMPLOYEE,LOCATION,decode(R,'1',R,'NULL') SEQ
from
(
select EMPLOYEE,LOCATION, TO_CHAR(row_number() over(partition by
LOCATION order by EMPLOYEE)) r
from KS_EMP
);
On 11/23/08, Vlad <[EMAIL PROTECTED]> wrote:
>
>
> Hi All,
>
> I have some data as follows:-
>
> Employee Location
> -------------- -------------
> Tom UK
> James UK
> Simon UK
> Bill France
> Edward France
> Chris France
>
>
> I want to be able to identify each row where there is a new location
> shown - it makes more sense in an example:-
>
> Tom,UK,1 <-- (First new occurenence of UK)
> James,UK,Null
> Simon,UK,Null
> Bill,France,1 <--First occurence of France)
> Edward,France,Null
> Chris,France,Null
>
> Is it possible to do this?
>
> TIA
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---