RE: Two table select (fwd)

From: Andy <alewis(at)mpsi(dot)net>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: PGSQL SQL <pgsql-sql(at)postgresql(dot)org>
Subject: RE: Two table select (fwd)
Date: 1999-02-03 19:11:52
Message-ID: Pine.LNX.4.05.9902031309060.11802-100000@shell.mpsi.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Wed, 3 Feb 1999, Jackson, DeJuan wrote:

>You could use unions, but I must ask why do you have all those rbldg#
>columns in your table?
>What's the basic thought behind your database layout?
> -DEJ

The rbldg#'s are holding Apts building numbers and the rbldgcomment#'s are
holding the comments for those buildings.

Andy

>
>> -----Original Message-----
>> From: Andy [mailto:alewis(at)mpsi(dot)net]
>> Sent: Wednesday, February 03, 1999 1:00 PM
>> To: djackson(at)cpsgroup(dot)com
>> Subject: Two table select (fwd)
>>
>>
>> The apts table is at the bottom.
>>
>> I guess what I am trying to do is to pick each rbldg[x] from
>> the referral query
>> and then take that and query the apts table for the bldgname.
>>
>> rbldg[x] is the apt building number and bldgname is the building name.
>>
>> Thanks
>>
>> Andy
>>
>>
>>
>> I have two queries that I'd like to make as one. Here are the queries:
>>
>> select * from referral where oid = $some_oid
>>
>> select bldgname from apts where bldgnum = 'rbldg1'
>>
>>
>> I am trying to get the bldgname from the apts table and want
>> to get all of the
>> bldgname's including rbldg2, rbldg3, rbldg4. Trying to do it
>> in one select
>> statment, is this possible?
>>
>>
>>
>> table = referral
>> +----------------------------------+--------------------------
>> --------+-------+
>> | rstate | varchar()
>> | 2 |
>> | rrif | varchar()
>> | 10 |
>> | rphone | varchar()
>> | 20 |
>> | rfirstname | varchar()
>> | 20 |
>> | rlastname | varchar()
>> | 25 |
>> | rbldg1 | varchar()
>> | 10 |
>> | rbldgcomment1 | text
>> | var |
>> | rbldg2 | varchar()
>> | 10 |
>> | rbldgcomment2 | text
>> | var |
>> | rbldg3 | varchar()
>> | 10 |
>> | rbldgcomment3 | text
>> | var |
>> | rbldg4 | varchar()
>> | 10 |
>> ....
>> +----------------------------------+--------------------------
>> --------+-------+
>>
>> Table = apts
>> +----------------------------------+--------------------------
>> --------+-------+
>> | Field | Type
>> | Length|
>> +----------------------------------+--------------------------
>> --------+-------+
>> | bldgnum | varchar()
>> | 10 |
>> | bldgname | varchar()
>> | 35 |
>> ...
>> +----------------------------------+--------------------------
>> --------+-------+
>>
>> Thanks in advance
>>
>> Andy
>>
>>
>>
>

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Jan Wieck 1999-02-03 19:50:36 Re: [SQL] Two table select
Previous Message Jackson, DeJuan 1999-02-03 19:09:06 RE: Two table select (fwd)