Getting both 2 or more results

From: "Greg Goble" <ggoble(at)rpo(dot)at>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Getting both 2 or more results
Date: 2003-01-23 14:00:59
Message-ID: 00e101c2c2e7$dc28f1e0$b105010a@usia.co.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi List,

Not sure if this is the correct list for
this submission. If not, guidance on the
appropriate list would be appreciated.

I have the following query, which I can't
get to do what I want:

[query prefix="sql3" list="1" sql="
SELECT instructor.code, instructor.name,
instructor.arrival, instructor.departure,
instructor.hotel, instructor.occupancy,
products.sku, products.trainer, products.trainer_b
FROM products, instructor
WHERE products.sku = '[cgi course]'
AND instructor.hotel = 'Theater Hotel'
AND instructor.code=products.trainer
"]

This query works, but only returns products.trainer
due to my last AND "instructor.code=products.trainer"

However, I want to return as well products.trainer_b
where instructor.code=products.trainer_b and sku and
instructor.hotel is the same.

I can do one or the other but not both at the same time.

How can I return values that belong to each
instructor.code WHERE
all instructor.hotel = 'Theater Hotel'
products.sku = '[cgi course]'?

Thanks, Greg

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2003-01-23 14:15:38 Re: embedded postgres
Previous Message Bruno Wolff III 2003-01-23 13:53:18 Re: standard schemas for addresses, others?