From: Thomas Chille <thomas.chille@gmail.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: difficult JOIN
Date: Tue, 25 Jan 2005 18:06:04 +0100
Message-ID: <cad2de1c050125090641f423b9@mail.gmail.com> (raw)
Hi,
i have the following SQL-Problem:
We are using 2 tables. The first, called plan, is holding planned
working times for employees per
tour:
plan.id_tour
plan.id_employee
plan.begin_time
plan.end_time
The second table 'work' stores the actual worked times for employees per tour:
work.id_tour
work.id_employee
work.begin_time
work.end_time
Employees can be multiple times assigned to one tour. One record will
be created for every
assignment. They can also work multiple times in one tour.
Now i wanna merge this infos into one report. I wanna join the first
plan entry for one employee in
one tour with the first work entry for one employee in one tour and so on.
How can i obtain that? A simply USING(id_tour, id_employee) -JOIN will not doit.
Thanks for any hints,
Thomas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: thomas.chille@gmail.com
Subject: Re: difficult JOIN
In-Reply-To: <cad2de1c050125090641f423b9@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox