I'm doing project where I have a table which has hash
and timestamp
columns. And the task is to delete all the rows which are hash
duplicates, leaving the ones with oldest timestamp
. I found a similar question on stack and I tried to adopt the given snippet to my needs, but I got an error in sqlite
near "shop_bogus": syntax error:
My adopted snippet:
DELETE shop_bogus
FROM shop_bogus b
JOIN (
SELECT MIN(a.timestamp) timestamp,
hash
FROM shop_bogus a
GROUP BY a.hash
) c ON
c.hash = b.hash
AND c.timestamp <> b.timestamp
What am I doing wrong?