Jump to content

Oracle Query .....help Help....


Recommended Posts

Posted

[quote name='Samanyudu' timestamp='1358200074' post='1303107788']
RNUM create chesi ranking esta anav kadha ...adi ela chestaru ................
[/quote]


After you create the rnum column

run this query


update t1
set t1.rnum = t2.rnum
from TABLE_NAME t1
inner join(
select item_id, rank() over (order by item_id) rnum
from TABLE_NAME
) as t2
on t1.item_id = t2.item_id


then update straight out easy ga vastundi neekey..

  • Replies 35
  • Created
  • Last Reply

Top Posters In This Topic

  • Samanyudu

    13

  • ChampakDas

    8

  • loveindia

    5

  • iTeachSAP

    4

Popular Days

Top Posters In This Topic

Posted

[quote name='loveindia' timestamp='1358200558' post='1303107832']


After you create the rnum column

run this query


update t1
set t1.rnum = t2.rnum
from TABLE_NAME t1
inner join(
select item_id, rank() over (order by item_id) rnum
from TABLE_NAME
) as t2
on t1.item_id = t2.item_id


then update straight out easy ga vastundi neekey..
[/quote]

emaindi raaja.. work aindaa ledaa??? cheptey santoshistam kada raaja..

Posted

[quote name='loveindia' timestamp='1358201330' post='1303107940']

emaindi raaja.. work aindaa ledaa??? cheptey santoshistam kada raaja..
[/quote]

Maa manager peliste vela baya ..nuvvu chepinatlu RNUM ane Coln create cheskuna..and used the below query

update t1
set t1.RNUM = t2.RNUM
from TABLE_ATGSKU t1
inner join(
select ITEM_ID, rank() over (order by ITEM_ID) RNUM
from TABLE_ATGSKU
) as t2
on t1.ITEM_ID = t2.ITEM_ID

Ayina work avala ..bossu.... :3D_Smiles_216:

Posted

[quote name='Samanyudu' timestamp='1358202362' post='1303108025']
Maa manager peliste vela baya ..nuvvu chepinatlu RNUM ane Coln create cheskuna..and used the below query

update t1
set t1.RNUM = t2.RNUM
from TABLE_ATGSKU t1
inner join(
select ITEM_ID, rank() over (order by ITEM_ID) RNUM
from TABLE_ATGSKU
) as t2
on t1.ITEM_ID = t2.ITEM_ID

Ayina work avala ..bossu.... :3D_Smiles_216:
[/quote]

ee query tho raastey aa table lo RNUM update avaledaa??? em error vachindi???

Posted

Use this : Assuming table name is "temp_Item"

Create table item as
Select t.*,
row_number () over(partition by item_id order by item_id, type) rn
from temp_item t;

Update item set = 'P1' where rn <= 200000 ;
Update item set = 'P2' where rn between 200001 and 400000 ;
Update item set = 'P3' where rn between 400001 and 600000 ;
Update item set = 'P4' where rn between 600001 and 800000 ;
Update item set = 'P5' where rn >= 800001 ;

Posted

Btw, is the item_id unique?? If not, create a sequence while inserting it into new table.
Then Update the table based on the sequence instead of row nunber.

×
×
  • Create New...