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           | [EMAIL PROTECTED]
 heidi         | [EMAIL PROTECTED]
 payday        | [EMAIL PROTECTED]
 fake          | [EMAIL PROTECTED]
 mattgerg      | [EMAIL PROTECTED]
 god           | [EMAIL PROTECTED]

select username, mailing_list from options;
   username    | mailing_list
---------------+--------------
 payday        | t
 god           | t
 fake          | t
 mattgerg      | 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 <[EMAIL PROTECTED]>


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Reply via email to