Error in SQL order: Delete where id in list

0

I'm trying to delete the rows of a table that correspond to the id (varchar) '938110842071146496', '938110904666853378', '938195226333777920', '938309442671665152', '938777508123734017'

For this I use the following SQL command:

DELETE FROM table WHERE id IN ('938110842071146496', '938110904666853378', '938195226333777920', '938309442671665152', '938777508123734017')

But it returns the following error:

  

# 1064 - Something is wrong in its syntax near 'WHERE id IN   ('938110842071146496', '938110904666853378', '9381952263337779' in the   Line 1

Does anyone know what is wrong?

    
asked by Pedro 04.03.2018 в 16:45
source

1 answer

0

Your Query is fine, how are the columns of your table?

DELETE from table WHERE id IN ("1","2","3",...,"254");

Now that if your columns are numerical try this

DELETE from tablename WHERE id BETWEEN 1 AND 254;

DELETE from tablename WHERE id BETWEEN 1 AND 254 AND id<>10;
    
answered by 05.03.2018 в 06:22