I have a table in sqlite database which consists of 61249 rows in that i just need 873 rows rest of the rows have to be deleted. I tried it by using loops concept but unfortunately. I am using dbbrowser sqlite to access this database. we cant use loops here can any one solve this.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
if you know how to select your 873 rows from your table you should do something do like this. Here is how to delete all rows except selected, in this example all rows except those where id is between 3 and 5...
DELETE FROM table1
WHERE id NOT IN (SELECT id FROM table1 WHERE id BETWEEN 3 AND 5);
Here is SQL Fiddle for that to see how that look like http://sqlfiddle.com/#!7/3d657/1