May 11, 2004 at 7:36 am
| |||||
May 11, 2004 at 9:51 am
This assumes that the combination of ID values is unique -- specifically, that the roleModule_ID field is a unique identifier of some sort for the table.
Note that this can be modified in multiple ways:
May 11, 2004 at 5:09 pm
select count(*) where yada, yada
then set rowcount = count(*) - 1
delete where yada, yada
May 11, 2004 at 9:29 pm
and then:
set rowcount 0
May 12, 2004 at 2:14 am
Hi!
Probably this code will help you.....
delete RoleModule
where roleModule_ID not in (select max(roleModule_ID) from RoleModule
group by Role_ID
having count(*) > 1 )
and Role_ID in (select Role_ID from RoleModule b
group by Role_ID
having count(*) > 1)
This is generic for deleting the values that are occuring more than once in your table leaving one occurance.
Indu
Indu Jakhar
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply