-3

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?

Community
  • 1
  • 1
  • Possible duplicate of [Deleting duplicate rows from sqlite database](http://stackoverflow.com/questions/8190541/deleting-duplicate-rows-from-sqlite-database) – Murphy Jun 07 '16 at 11:51

1 Answers1

0

The answer you ripped the statement from is for MS SQL Server; SQLite doesn't support this syntax for DELETE.

Murphy
  • 3,827
  • 4
  • 21
  • 35