Home > database >  How do I remove redundancy data SQL
How do I remove redundancy data SQL

Time:09-24

I have a data table as shown in figure, I use first group by Fcode, Ftype screening redundance,

The select Fcode form TB
Group by Fcode, Ftype
Having a count (Fcode) & gt; 1

Then I want to delete redundant lines, such as a picture in the first line, how do I write a delete statement?

CodePudding user response:

 delete a 
The from TB a
Where
The exists (select 1 from TB where b=a.f code b. code and a.f type=b. type and a.c time & lt; The biggest time)
  • Related