loveindia Posted January 14, 2013 Report Posted January 14, 2013 [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..
loveindia Posted January 14, 2013 Report Posted January 14, 2013 [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..
Samanyudu Posted January 14, 2013 Author Report Posted January 14, 2013 [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....
loveindia Posted January 14, 2013 Report Posted January 14, 2013 [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.... [/quote] ee query tho raastey aa table lo RNUM update avaledaa??? em error vachindi???
rajivn786 Posted January 14, 2013 Report Posted January 14, 2013 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 ;
rajivn786 Posted January 14, 2013 Report Posted January 14, 2013 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.
Recommended Posts