|
I have 2 tables as follow
Category ahve lots of data for ex
PlanName category RName
Contract Loss PQR
Contract Pay DEF
Contract General ABC
Contract Gereral Test
Contract General XYZ
data
Key SeqNbr TKey RName
-------------- ---------- -------------- ------------------------------
10128 1 62746 PQR
10128 2 62747 DEF
10128 3 62748 TEST
10128 4 62749 XYZ
10291 1 63839 PQR
10291 2 63840 DEF
10291 3 63841 ABC
10291 4 63842 TEST
I want to resqeuence the Rname those are coming from "General" category.
For Ex - update the sequence of TEST.It should be after DEF
As "TEST" and ABC is from same "Category" for Key 10291.
For 10128 no need to change the squernce because this key have only "TEST" from category = "General"
I want the O/p as follow
Key SeqNbr TKey RName
-------------- ---------- -------------- ----------------------------
10128 1 62746 PQR
10128 2 62747 DEF
10128 3 62748 TEST
10128 4 62749 XYZ
10291 1 63839 PQR
10291 2 63840 DEF
10291 3 63841 TEST
10291 4 63842 ABC
1.PLz tell me how I can find out key which have more than 1 RName from "General" Category and also
2.plz tell me how I can update
TEST SeqNbr would need to be changed to 3,
TKey to 63841 .ABC SeqNbr would have
to be changed to 4, TKey to 63842
I want to create a proc for this.
|