RB Smissaert <[EMAIL PROTECTED]>
wrote:
> Can this be done in SQLite SQL?
>
> ID Value
> ---------------
> 1 A
> 1 B
> 1 C
> 1 D
> 1 E
> 2 A
> 2 B
> 2 C
> 2 D
> 2 E
> 2 F
>
> Delete rows to leave x rows per ID, say 3 rows, so we get:

delete from tableName where rowid not in (
    select rowid from tableName t2
    where t2.ID = tableName.ID
    order by Value desc
    limit 3
);

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to