Re: [GENERAL] date range query help

2008-11-20 Thread Tom Lane
Sam Mason <[EMAIL PROTECTED]> writes: > I sometimes find it easier to store ranges like this with having the > open ends at infinity. This is easier with timestamps as they have > magic 'infinity' values in PG (both positive and negative). Values of > date type don't have any special values like

Re: [SQL] [GENERAL] date range query help

2008-11-20 Thread Frank Bax
novice wrote: 2008/11/20 Rodrigo E. De León Plicet <[EMAIL PROTECTED]>: On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> wrote: sorry I get nothing :( Of course not. None of the dates you gave in the example overlap. But it should still have the 1st entry with the name Ben? Am

Re: [GENERAL] date range query help

2008-11-20 Thread Sam Mason
On Thu, Nov 20, 2008 at 01:10:41PM +1100, novice wrote: > select * from mobile_custodian; > > custodian_id | user_id | issue_date | return_date | mobile_no > --+-++-+- > 4 | Ben | 2008-10-11 | 2008-10-13 | 09455225998 >

Re: [GENERAL] date range query help

2008-11-19 Thread Raymond C. Rodgers
Adam Rich wrote: Now user Ben has passed his mobile to user Josh and we issued Josh his mobile on 2008-10-15. 1. Is it possible for me to write a query that will have the fields call.call_id, call.datetime, mobile_custodian.user_id, call.mobile_no call.charge that will use call.datetime and lo

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread Joshua D. Drake
On Thu, 2008-11-20 at 15:41 +1100, novice wrote: > omg - how embarrassing. > so sorry :( > I note your name is novice. Don't sweat it. We are here to help. Joshua D. Drake -- -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread Adam Rich
> >> sorry I get nothing :( > > > > Of course not. None of the dates you gave in the example overlap. > > > > But it should still have the 1st entry with the name Ben? Am I > missing something? Ben's issue dates are in the year 2008. The first call entry is in the year 2007. There are no cust

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread novice
omg - how embarrassing. so sorry :( 2008/11/20 brian <[EMAIL PROTECTED]>: > novice wrote: >> >> 2008/11/20 Rodrigo E. De León Plicet <[EMAIL PROTECTED]>: >>> >>> On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> >>> wrote: sorry I get nothing :( >>> >>> Of course not. None of

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread brian
novice wrote: 2008/11/20 Rodrigo E. De León Plicet <[EMAIL PROTECTED]>: On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> wrote: sorry I get nothing :( Of course not. None of the dates you gave in the example overlap. But it should still have the 1st entry with the name Ben? Am

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 Rodrigo E. De León Plicet <[EMAIL PROTECTED]>: > On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> wrote: >> sorry I get nothing :( > > Of course not. None of the dates you gave in the example overlap. > But it should still have the 1st entry with the name Ben? Am I missing

Re: [SQL] [GENERAL] date range query help

2008-11-19 Thread Rodrigo E. De León Plicet
On Wed, Nov 19, 2008 at 10:03 PM, novice <[EMAIL PROTECTED]> wrote: > sorry I get nothing :( Of course not. None of the dates you gave in the example overlap. -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mai

Re: [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 brian <[EMAIL PROTECTED]>: > novice wrote: >> >> 2008/11/20 Adam Rich <[EMAIL PROTECTED]>: >>> >>> select call.call_id, >>> call.datetime, >>> mobile_custodian.user_id, >>> call.mobile_no >>> call.charge >>> from call, mobile_custodian >>> where call.mobile_no = mobile_custodian.mobi

Re: [GENERAL] date range query help

2008-11-19 Thread brian
novice wrote: 2008/11/20 Adam Rich <[EMAIL PROTECTED]>: select call.call_id, call.datetime, mobile_custodian.user_id, call.mobile_no call.charge from call, mobile_custodian where call.mobile_no = mobile_custodian.mobile_no and call.datetime between mobile_custodian.issue_date and mob

Re: [GENERAL] date range query help

2008-11-19 Thread novice
2008/11/20 Adam Rich <[EMAIL PROTECTED]>: >> Now user Ben has passed his mobile to user Josh and we issued Josh his >> mobile on 2008-10-15. >> >> 1. Is it possible for me to write a query that will have the fields >> >> call.call_id, >> call.datetime, >> mobile_custodian.user_id, >> call.mobile_no

Re: [GENERAL] date range query help

2008-11-19 Thread Adam Rich
> Now user Ben has passed his mobile to user Josh and we issued Josh his > mobile on 2008-10-15. > > 1. Is it possible for me to write a query that will have the fields > > call.call_id, > call.datetime, > mobile_custodian.user_id, > call.mobile_no > call.charge > > that will use call.datetime a

[GENERAL] date range query help

2008-11-19 Thread novice
Hi, We have two tables. select * from mobile_custodian; custodian_id | user_id | issue_date | return_date | mobile_no --+-++-+- 4 | Ben | 2008-10-11 | 2008-10-13 | 09455225998 5 |Josh | 2008-10-15 |