You'll obv want to give the * fields aliases to be able to access them more
easily.

On Wed, May 20, 2009 at 1:26 AM, David McGuigan <[email protected]>wrote:

> I'm actually on a computer without any serverware right now to test this
> out but I think you can do something like:
>
> select ta.*, tb1.*, tb2.*
> from tableA ta, tableB tb1, tableB tb2
> where ta.from = tb1.pk and ta.to = tb2.pk
>
>
>
>
> On Wed, May 20, 2009 at 1:20 AM, Marie Taylore <[email protected]> wrote:
>
>>
>> I know this is probably simpler than I'm making it, but I have Table A
>> with two different "references" to the primary key in table B.
>>
>> Table A
>> =======
>> From  To
>> ====  ==
>> 1     2
>> 2     4
>> 3     7
>>
>> Table B
>> =======
>> PK  Firstname  Lastname
>> ==  =========  ========
>> 1   John       Doe
>> 2   Jane       Doe
>> 3   John       Smith
>> 4   Jane       Smith
>> 7   Frank      Jones
>>
>> I need to be able to show the first and last names from Table A's
>> references to the PK in Table B (for both fields From and To).
>>
>> Basically, I'm trying to get the following output:
>>
>> Sent From   Sent To
>> ==========  =======
>> John Doe    Jane Doe
>> Jane Doe    Jane Smith
>> John Smith  Frank Jones
>>
>> What kind of join do I need to make this work?  Or does my table design
>> not allow this?  Regular inner joins don't seem to be working, and I'm
>> certainly no SQL wiz.
>>
>> Any help is appreciated.
>>
>> MarieT
>>
>>
>>
>>
>>
>> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:322651
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to