|
- Your topic is not clear, and I am too lazy to speculate here, although the following generations
- The code may not give you the answer, but it can give you an idea.
declare @aa table (
aa int,
bb int,
cc char(8)
)
insert into @aa (aa, bb, cc)
select 1, 255, '20161212' union all
select 1, 15, '20161210' union all
select 2, 33, '20160612' union all
select 2, 11, '20160101'
--/Before performing the delete operation, you must perform the select operation, first see if the deletion is correct.
select *
from @aa a
where cc = (
select max(cc)
from @aa
where aa = a.aa
)
- After confirming that the previous step is correct, execute the next step to delete.
delete a
from @aa a
where cc = (
select max(cc)
from @aa
where aa = a.aa
)
- View the result after deletion
select * from @aa |
|