Re: SQL Statement Help Needed - Mailing list pgsql-novice

From Frank Bax
Subject Re: SQL Statement Help Needed
Date
Msg-id 5.2.1.1.0.20051204093529.00a3d470@pop6.sympatico.ca
Whole thread Raw
In response to SQL Statement Help Needed  ("Michael Avila" <Michael.Avila.1@sbcglobal.net>)
Responses Re: SQL Statement Help Needed
List 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


pgsql-novice by date:

Previous
From: Marcus Engene
Date:
Subject: Re: What is the Best Way to Learn PL/pgSQL?
Next
From: brew@theMode.com
Date:
Subject: Re: SQL Statement Help Needed