Re: Join several tables (to fetch user info), but one of them is optional (user avatar)

Поиск
Список
Период
Сортировка
От Alexander Farber
Тема Re: Join several tables (to fetch user info), but one of them is optional (user avatar)
Дата
Msg-id CAADeyWi=EUdkZ7WOT1fUe+L8SFqZeDVG=XMcV2552mMzVXyysg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Join several tables (to fetch user info), but one of them is optional (user avatar)  (Albe Laurenz <laurenz.albe@wien.gv.at>)
Ответы Re: Join several tables (to fetch user info), but one of them is optional (user avatar)
Список pgsql-general
Thank you, I've ended up with:

# select
        u.uid,
        /* u.pass, */
        f.filename as avatar,
        (g.field_gender_value='Female') as female,
        c.field_city_value as city
from
        drupal_users u LEFT OUTER JOIN drupal_file_managed f on
(u.picture=f.fid),
        drupal_field_data_field_gender g,
        drupal_field_data_field_city c
where
        u.name='mvp' and
        g.entity_id=u.uid and
        c.entity_id=u.uid
;
  uid  | avatar | female |     city
-------+--------+--------+--------------
 18539 |        | f      | Moscow
(1 row)

I wonder though what is the syntax if I wanted
the other 2 tables (drupal_field_data_field_gender
and drupal_field_data_field_city) to be joined
as a "left outer join" as well?

Regards
Alex


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

Предыдущее
От: Albe Laurenz
Дата:
Сообщение: Re: Join several tables (to fetch user info), but one of them is optional (user avatar)
Следующее
От: Jason Ma
Дата:
Сообщение: How to startup the database server?