Reputation: 27
I created a table with a column containing numbers listed from 1 to 100. I want to delete numbers that divide by 3 without any remainder. Who can recommend me a way (script) to do that. Only logic I could make in this problem is that if the sum of digits of a number can divide by 3 that means any number which correspond to that case could be divisible.
Upvotes: 0
Views: 168
Reputation: 87
If you are looking to delete the rows with number divisible completely by 3, you can use built-in modulus function
You could say something like this
delete
from myTable
where colNumber%3 = 0
Upvotes: 3
Reputation: 41
This query should solve your problem
DELETE FROM table WHERE (id % 3) = 0;
Upvotes: 2