I don't understand why you are simulating distinct. Either something is going completely over my head (quite possible) or you are making things harder than they need to be.
If you want to insert into T1 a distinct set of rows from T2 that don't already exist in T1, you could do this: select distinct col1, col2 from T1 where not exists ( select col1, col2 from T2 where T1.col1 = T2.col1 and T1.col2 = T2.col2 ) Regards Tim Romano Swarthmore PA On Thu, May 6, 2010 at 9:14 AM, Matt Young <youngsan...@gmail.com> wrote: > Got it, thinks Jay. > > > On 5/6/10, Jay A. Kreibich <j...@kreibi.ch> wrote: > > On Thu, May 06, 2010 at 05:10:31AM -0700, Matt Young scratched on the > wall: > >> OK, I got it. > >> > >> insert into seriesid > >> select series_id,min(ROWID) from > >> seriesdata group by series_id; > >> > >> This gets me a table with a pointer to the firs instance of series_id > >> in the bigger table having multiple copies, it assumes that the ids > >> are contiguous, allowing me to use offset, limit to extract just the > >> date series I want. > > > > It would make a lot more sense to just query the seriesdata table with > > a "WHERE series_id = :id" condition. You're writing SQL, but you're > > still thinking in C. > > > > > > > > Also, you don't want to be using ROWID as the target of your foreign > key. > > In cases like this, setup an explicit INTEGER PRIMARY KEY, which will > > act as a ROWID alias. > > > > The difference is that ROWIDs are not stable through a VACUUM, while > > INTEGER PRIMARY KEYs are properly preserved. > > > > -j > > > > -- > > Jay A. Kreibich < J A Y @ K R E I B I.C H > > > > > "Our opponent is an alien starship packed with atomic bombs. We have > > a protractor." "I'll go home and see if I can scrounge up a ruler > > and a piece of string." --from Anathem by Neal Stephenson > > _______________________________________________ > > sqlite-users mailing list > > sqlite-users@sqlite.org > > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > > > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users