Black, Michael (IS) <michael.bla...@ngc.com> wrote:
> The "NOT IN" approach doesn't work..here's sample data using select rather 
> than delete to show the result.
> 
> sqlite> select * from THI where ID not in (
>    ...> select ID from THI t2 where t2.UserID = UserId
>    ...> order by t2.TimeStamp desc limit 10);

This does work:

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

> Whereas the inclusion approach does work
> sqlite> select *  from thi as a where a.id in
>    ...> (select thi.id from thi where a.userid=thi.userid
>    ...> order by timestamp limit 1000000 offset 10);

The difference is not inclusion vs exclusion, but the fact that you spelled out 
thi.userid and I forgot to.

Igor Tandetnik

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

Reply via email to