SQL Statement Help Needed

From: "Michael Avila" <Michael(dot)Avila(dot)1(at)sbcglobal(dot)net>
To: "Novice PostgreSQL Mail List" <pgsql-novice(at)postgresql(dot)org>
Subject: SQL Statement Help Needed
Date: 2005-12-04 09:12:48
Message-ID: NBBBLNPHAMCFENDFHIDCGEGGEGAA.Michael.Avila.1@sbcglobal.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I am not much of a SQL guru so I am having trouble trying to figure out how
to format a SQL statement.

I have a table with members named members. Each member has only 1 record.
Then I have a table with member telephone numbers in it name
membertelephones. A member can have more than one telephone number (home,
work, cell, pager, fax, etc.). I want to print out the telephone numbers of
the members. Is it possible to do it in one SQL statement like with a JOIN
or something or do I need to get the members and then loop through the
membertelephones to get the telephone numbers? Is it possible to do a JOIN
with a table with one record with a table with multiple records?

SELECT * FROM member

SELECT * FROM membertelephone WHERE member_id = the id from the above SELECT

Thanks for the help.

Mike

Attachment Content-Type Size
winmail.dat application/ms-tnef 1.7 KB

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Ilias Goudaropoulos 2005-12-04 11:45:21 Re: PostgreSQL 8.1.0-2 WinXP Services
Previous Message Srinivas Iyyer 2005-12-03 23:59:44 Re: What is the Best Way to Learn PL/pgSQL?