complex query

Поиск
Список
Период
Сортировка
От Matt Gerginski
Тема complex query
Дата
Msg-id 1046689145.1223.7.camel@MattGerg
обсуждение исходный текст
Ответы Re: complex query  ("Victor Yegorov" <viy@pirmabanka.lv>)
Список pgsql-sql
I have two tables, users and options.  The common element between the
tables is "username".  I want to select the "email" from "user" but only
if the "mailing_list" option is set to true in the "options" table.

Here are the tables:

select username, email from users;  username    |             email
---------------+--------------------------------joe           | joe@yahoo.comheidi         | heidi@localhostpayday
 | brant@localhostfake          | fake@localhostmattgerg      | mattgerg@users.sourceforge.netgod           |
god@heaven.org

select username, mailing_list from options;  username    | mailing_list
---------------+--------------payday        | tgod           | tfake          | tmattgerg      | t


I want to write a query that will return the emails of only the users
payday, god, fake, and mattgerg.

Is this at all possible?  I am new to sql, and I am having trouble.

--Matt



-- 
Matt Gerginski <mattgerg@users.sourceforge.net>



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

Предыдущее
От: Achilleus Mantzios
Дата:
Сообщение: Re: Querying Hierarchical Data
Следующее
От: saintxplo@yahoo.com.ar (Saint X)
Дата:
Сообщение: Insert multiple Rows