Обсуждение: Getting both 2 or more results

Поиск
Список
Период
Сортировка

Getting both 2 or more results

От
"Greg Goble"
Дата:
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