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

Reply via email to