Getting both 2 or more results - Mailing list pgsql-general

From Greg Goble
Subject Getting both 2 or more results
Date
Msg-id 00e101c2c2e7$dc28f1e0$b105010a@usia.co.at
Whole thread Raw
List 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



pgsql-general by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: standard schemas for addresses, others?
Next
From: Bruno Wolff III
Date:
Subject: Re: embedded postgres