Re: Time Difference

From: Peter Pilsl <pilsl(at)goldfisch(dot)at>
To: Mike E <mee(at)quidquam(dot)com>
Cc: postgres mailinglist <pgsql-general(at)postgresql(dot)org>
Subject: Re: Time Difference
Date: 2000-10-27 12:13:07
Message-ID: 20001027141307.A5336@i3.atat.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, Oct 27, 2000 at 04:13:13AM -0700, Mike E wrote:
> I have the following setup:
>
> appt=# select * from availability \g
> emp_id | date | start_time | end_time
> --------+------------+------------+----------
> 1 | 2000-10-30 | 08:00:00 | 14:30:00
>
> appt=# select * from appointments \g
> start_time | end_time | emp_id | cus_id | services | date
> ------------+----------+--------+--------+----------+------------
> 09:00:00 | 11:30:00 | 1 | 2 | {1,2,3} | 2000-10-30
>
> Now, what I would like to get is the following:
>
> start_time | end_time
> ------------+----------
> 08:00:00 | 09:00:00
> 11:30:00 | 14:30:00
>

not sure about the exact syntax, but to give you an idea:

select av.starttime as start_time,ap.starttime as end_time from availability av, appointments ap where av.emp_id=ap.emp_id and av.emp_id=1;

Same concept for the second row and then use the union-feature of the select-command to join.

hope this helps,
peter

--
mag. peter pilsl
email: pilsl(at)goldfisch(dot)at
pgp-key available

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Pilsl 2000-10-27 12:17:23 select and null
Previous Message paul 2000-10-27 12:00:22 determining current table & record within stored procedure ?