Skip to content

Instantly share code, notes, and snippets.

@mingcheng
Created December 19, 2014 01:51
Show Gist options
  • Select an option

  • Save mingcheng/835238415f94c2c35285 to your computer and use it in GitHub Desktop.

Select an option

Save mingcheng/835238415f94c2c35285 to your computer and use it in GitHub Desktop.
SQLite 获取和删除重复的数据
# 获取重复的数据
select title, id, count(*) as count from eslpod group by title having count(*) > 1;
# 删除重复的数据,其中 rowid 为 sqlite 自带字段
delete from eslpod where eslpod.rowid not in (select max(eslpod.rowid) from eslpod group by
title);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment