Re: SQL Statement Help Needed

From: Frank Bax <fbax(at)sympatico(dot)ca>
To: pgsqlnovice <pgsql-novice(at)postgresql(dot)org>
Subject: Re: SQL Statement Help Needed
Date: 2005-12-04 14:45:30
Message-ID: 5.2.1.1.0.20051204093529.00a3d470@pop6.sympatico.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

At 04:12 AM 12/4/05, Michael Avila wrote:
>I have a table with members named members. Each member has only 1 record.
>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

Yes.

>do I need to get the members and then loop through the
>membertelephones to get the telephone numbers?

No.

>Is it possible to do a JOIN
>with a table with one record with a table with multiple records?

Yes.

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

http://en.wikipedia.org/wiki/Join_%28SQL%29

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message brew 2005-12-04 19:16:57 Re: SQL Statement Help Needed
Previous Message Marcus Engene 2005-12-04 12:44:45 Re: What is the Best Way to Learn PL/pgSQL?