From: | novice <user(dot)postgresql(at)gmail(dot)com> |
---|---|
To: | "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org |
Subject: | Re: date range query help |
Date: | 2008-11-20 03:03:05 |
Message-ID: | ddcb1c340811191903y211607ebic2c1aa5e5b564042@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-novice pgsql-sql |
2008/11/20 Adam Rich <adam(dot)r(at)sbcglobal(dot)net>:
>> 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 lookup the date range from
>> mobile_custodian.issue_date and mobile_custodian.return_date to
>> identify the right user for each call?
>>
>> 2. Do I need to change the issue_date & return_date fields to
>> timestamp to perform the above?
>>
>
> No, a date will work fine. Try this:
>
>
> 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 mobile_custodian.return_date
sorry I get nothing :(
From | Date | Subject | |
---|---|---|---|
Next Message | brian | 2008-11-20 03:28:03 | Re: date range query help |
Previous Message | Adam Rich | 2008-11-20 02:42:51 | Re: date range query help |
From | Date | Subject | |
---|---|---|---|
Next Message | brian | 2008-11-20 03:28:03 | Re: date range query help |
Previous Message | Adam Rich | 2008-11-20 02:42:51 | Re: date range query help |
From | Date | Subject | |
---|---|---|---|
Next Message | brian | 2008-11-20 03:28:03 | Re: date range query help |
Previous Message | Adam Rich | 2008-11-20 02:42:51 | Re: date range query help |