Re: [sqlite] SQLite relative dates and join query help

2014-08-13 Thread Ben
...@sqlite.org] On Behalf Of Petite Abeille Sent: Tuesday, 12 August, 2014 12:15 To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite relative dates and join query help On Aug 12, 2014, at 7:38 PM, Ben sqlite_l...@menial.co.uk wrote: The result I'm after is: id, prod_code

Re: [sqlite] SQLite relative dates and join query help

2014-08-13 Thread Petite Abeille
On Aug 13, 2014, at 3:43 AM, Keith Medcalf kmedc...@dessus.com wrote: I don't think you want max() around collections.book_in_date. You want the max(collection_date) but the book_in_date from that row. Since the collection_date is unique, the book_in_date can only come from one record.

[sqlite] SQLite relative dates and join query help

2014-08-12 Thread Ben
I'm trying to solve the following problem in SQLite: Items are being produced with a short, fixed shelf life. Say 50 days. Item can be collected every two weeks, where each item must be registered a week before. I am trying to create a query where I can list current items and the latest day

Re: [sqlite] SQLite relative dates and join query help

2014-08-12 Thread Luuk
On 12-8-2014 19:38, Ben wrote: I'm trying to solve the following problem in SQLite: Items are being produced with a short, fixed shelf life. Say 50 days. Item can be collected every two weeks, where each item must be registered a week before. I am trying to create a query where I can list

Re: [sqlite] SQLite relative dates and join query help

2014-08-12 Thread Petite Abeille
On Aug 12, 2014, at 7:38 PM, Ben sqlite_l...@menial.co.uk wrote: The result I'm after is: id, prod_code, creation_date, last_book_in_date, last_collection_date Where the final two columns are from the collection which is the farthest in the future, but still within the 50-day period

Re: [sqlite] SQLite relative dates and join query help

2014-08-12 Thread Keith Medcalf
[mailto:sqlite-users- boun...@sqlite.org] On Behalf Of Petite Abeille Sent: Tuesday, 12 August, 2014 12:15 To: General Discussion of SQLite Database Subject: Re: [sqlite] SQLite relative dates and join query help On Aug 12, 2014, at 7:38 PM, Ben sqlite_l...@menial.co.uk wrote: The result I'm after