Skip to content

Instantly share code, notes, and snippets.

@mdornseif
Created December 25, 2010 10:05
Show Gist options
  • Save mdornseif/754805 to your computer and use it in GitHub Desktop.
Save mdornseif/754805 to your computer and use it in GitHub Desktop.
Dedutpe Table buchdurchschnittspreis2
DELETE FROM buchdurchschnittspreis2
WHERE id in
(SELECT buchdurchschnittspreis2.id FROM buchdurchschnittspreis2
LEFT OUTER JOIN (select min(id) as id from buchdurchschnittspreis2
GROUP BY (artnr, datum) as KeepRows
ON buchdurchschnittspreis2.id=KeepRows.id
WHERE KeepRows.id IS NULL);
@omarzina
Copy link

omarzina commented Jul 8, 2015

DELETE FROM buchdurchschnittspreis2
WHERE id in
(SELECT buchdurchschnittspreis2.id FROM buchdurchschnittspreis2
LEFT OUTER JOIN
(select min(id) as id from buchdurchschnittspreis2
GROUP BY (artnr, datum)) as KeepRows
ON buchdurchschnittspreis2.id=KeepRows.id
WHERE KeepRows.id IS NULL);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment