Re: [sqlite] Should this work?

2010-05-10 Thread Matt Young
Reading your response, thinks. I did however find that the incoming data did not conform to what I expects (contiguous series_id), so the code worked, my thinking did not. On 5/10/10, Tim Romano wrote: > The select/group by part of your statement will group table SERIESDATA by > text-column serie

Re: [sqlite] Should this work?

2010-05-10 Thread Tim Romano
The select/group by part of your statement will group table SERIESDATA by text-column series_id (aliased to id) and return the min and max data_index for each grouping, assuming those columns are populated with data for each row. The set will have three columns and some number of rows, one per id.

[sqlite] Should this work?

2010-05-09 Thread Matt Young
# series data looks like: create table seriesdata ( data_index INTEGER PRIMARY KEY autoincrement, series_id text, year numeric, value numeric); # and is filled insert into seriesid select s.series_id as id, min(data_index),max(data_index)

Re: [sqlite] Should this work?

2010-05-06 Thread Tim Romano
elaboration: " ... you could this (to find the set to be inserted): " TR ___ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Re: [sqlite] Should this work?

2010-05-06 Thread Tim Romano
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 dis

Re: [sqlite] Should this work?

2010-05-06 Thread Matt Young
Got it, thinks Jay. On 5/6/10, Jay A. Kreibich 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 pointe

Re: [sqlite] Should this work?

2010-05-06 Thread Jay A. Kreibich
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 hav

Re: [sqlite] Should this work?

2010-05-06 Thread Matt Young
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,

Re: [sqlite] Should this work?

2010-05-06 Thread Simon Davies
On 6 May 2010 12:03, Matt Young wrote: > # I am doing a simulation of distinct > > insert into seriesid (series_id,pointer) >        select  series_id,ROWID from seriesdata as s >                where s.series_id not in( >                select >                        series_id >                f

Re: [sqlite] Should this work?

2010-05-06 Thread Fredrik Karlsson
Hi, Have you had a look at the EXCEPT statement? http://www.sqlite.org/lang_select.html (bottom of page) "EXCEPT takes the result of left SELECT after removing the results of the right SELECT. " Does this make sense to you? /Fredrik On Thu, May 6, 2010 at 1:03 PM, Matt Young wrote: > # I am d

[sqlite] Should this work?

2010-05-06 Thread Matt Young
# I am doing a simulation of distinct insert into seriesid (series_id,pointer) select series_id,ROWID from seriesdata as s where s.series_id not in( select series_id from seriesid