Igor Tandetnik <itandet...@mvps.org> wrote:
> delete from THI where ID not in (
>    select ID from THI t2 where t2.UserID = UserId
>    order by t2.TimeStamp desc limit 10);

Correction:

delete from THI where ID not in (
    select t2.ID from THI t2 where t2.UserID = THI.UserId
    order by t2.TimeStamp desc limit 10);

THI.UserId is important; without THI. prefix, UserId from t2 (the nested table) 
is taken.
-- 
Igor Tandetnik

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to