Here is the thing, if we have a table with the following structure, there are thousands of records in this table, and probably some of which is duplicated. Now we need to delete those duplications by a sql query, what we should do?
There are many different ways can accomplish this, like cursor, tempary table, concatenate columns together and then use distinct operator etc. But here I'm gonna tell you another easy way.
DELETEFROM postings WHEREEXISTS ( SELECTNULLFROM postings b WHERE b.[postingname]= postings.[postingname]AND b.[postedby]= postings.[postedby] GROUPBY b.[postingname], b.[postedby] HAVING postings.[id]<MAX(b.[id]) )