views:

91

answers:

1
+1  Q: 

select the maximun

i have a table

sou_id  sou-name  rool_upid  roll_upname
1        AA           null        null
2       BB            null         null
3       CC             null         null
1        DD           null         null
2         EE          null         null
5       CC            null          null

i need to first use an update statement to get --if there is same id with multiple name i need to get maximum of it in roll_upid and roll_upname

i.e. AFTER UPDATE THE ABOVE TABLE SHOULD HAVE VALUES LIKE THIS

sou_id  sou-name  rool_upid  roll_upname
1        AA          1           DD
2       BB            2           EE
3       CC             3         CC
1        DD           1         DD
2         EE          2         EE
5       CC            5          CC

now AGAIN check and update gor ---- if the roll_upname is same and roll_upid is multiple take maximum

i need another Update statement for this

thus final table after the 2nd update wshould be like this

sou_id  sou-name  rool_upid  roll_upname
1        AA          1           DD
2       BB            2           EE
3       CC           5        CC
1        DD           1         DD
2         EE          2         EE
5       CC            5          CC

please help as soon as psossible i need it
thanx in advance

+1  A: 

i need to first use an update statement to get --if there is same id with multiple name i need to get maximum of it in roll_upid and roll_upname

To help me understand you need to use an update statement to find if there are multiple names with the same sou_id, and then find the maximum value for roll_upid and roll_upname?

Why not use a select statement?

What is the logic behind the row AA having a roll_upname of DD? and row BB having a roll_upname of EE?

george9170