pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Avila <Michael.Avila.1@sbcglobal.net>
To: PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: SQL Statement Help needed
Date: Sun, 4 Dec 2005 07:31:58 -0500
Message-ID: <NBBBLNPHAMCFENDFHIDCEEGHEGAA.Michael.Avila.1@sbcglobal.net> (raw)

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

Attachments:

  winmail.dat (application/ms-tnef, 1.7K) download

view thread (2+ messages)  latest in thread

Message-ID: <NBBBLNPHAMCFENDFHIDCEEGHEGAA.Michael.Avila.1@sbcglobal.net>
Permalink:  ../NBBBLNPHAMCFENDFHIDCEEGHEGAA.Michael.Avila.1@sbcglobal.net/
Also on:    postgresql.org/message-id/NBBBLNPHAMCFENDFHIDCEEGHEGAA.Michael.Avila.1@sbcglobal.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: Michael.Avila.1@sbcglobal.net
  Subject: Re: SQL Statement Help needed
  In-Reply-To: <NBBBLNPHAMCFENDFHIDCEEGHEGAA.Michael.Avila.1@sbcglobal.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox