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_idand 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@goldfisch.at
pgp-key available