JOIN condition confusion

Поиск
Список
Период
Сортировка
От Thomas Good
Тема JOIN condition confusion
Дата
Msg-id Pine.LNX.4.44.0510311325420.17323-100000@q8.nrnet.org
обсуждение исходный текст
Ответы Re: JOIN condition confusion  (Richard Huxton <dev@archonet.com>)
Список pgsql-sql
Hi,

I am wondering if there is a way to set conditions on a left joined
table without hosing the join altogether:

query = qq |SELECT p.*, a.user_id            FROM patient_dosing p            LEFT JOIN patient_assignment a
ONp.patient_id = a.patient_id            WHERE p.dose_type = 'Missed (AWOL)'            AND (p.dose_date >= $start_date
ANDp.dose_date <= $end_date)            -- the next two conditions hose the left join            -- AND a.end_date IS
NULL           -- AND lower(a.assign_type) = 'primary'            ORDER BY a.user_id, p.patient_id| if ($dbtype ne
"oracle");

Thanks much!
Tom




В списке pgsql-sql по дате отправления:

Предыдущее
От: "zackchandler"
Дата:
Сообщение: Design question: Scalability and tens of thousands of tables?
Следующее
От: "alessandra de gregorio"
Дата:
Сообщение: serial in output