On 3 Jul 2009, at 10:03pm, Rick Ratchford wrote:

> Suppose my 15 Dates are:
>
> 2009-03-03
> 2008-11-05
> 2008-07-10
> ...
> ...
> 2007-07-23
>
>
> Assuming this is a SORTED dataset in ascending order by Date, I  
> would need
> to extract 40 records that start with the record at 2009-03-03, then  
> 40
> records starting with the record at 2008-11-05, and so-forth.
>
> Can I do this in one SQL statement and have it produce one Recordset  
> of this
> result? Or would I have to run 15 different queries?

If you have exactly 40 records for each day then you can do it with a  
JOIN.  Or put all the dates into a long string like  
'x2009-03-03x2008-11-05x ...' and use 'LIKE'.  However, if you have  
different numbers of entries for each day then I can't think of a way  
to do it in one SELECT.

Oh, hold on, you mean you have one record for each day, and you want  
the records for those days and the 39 days after each of those days.   
You could make an extremely long SELECT with lots of 'AND' clauses.   
But I think you're going to have to do it in software.

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

Reply via email to