On 20 Aug 2010, at 11:54pm, Peng Yu wrote: > select * from A as A1, A as A2 where A1.name=A2.name and > abs(A1.position - A2.position) <= 10 and A1.position != A2.position;
If you're doing this a lot, work out which chunks of 20 each point is in. You only need to compare a point with points in two chunks of 20: the one below and the one above. So you can reject almost all the points immediately. Simon. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users