If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Inner Join Issue

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-31-07, 18:11
mlong30 mlong30 is offline
Registered User
 
Join Date: Oct 2007
Posts: 13
Inner Join Issue

Hi all,

I just written an inner join statement, but would like to run another INNER JOIN against the results of the first INNER JOIN. Is this possble? If so, how?

Thanks.

Matt
Reply With Quote
  #2 (permalink)  
Old 10-31-07, 19:08
amthomas amthomas is offline
Registered User
 
Join Date: May 2005
Location: San Antonio, Texas
Posts: 134
think of it just like joining two tables together. It is really the same thing. You are basically joining the result set of the first join with the 3rd table.

select * from tablea a inner join tableb b (on a.id = b.id) inner join tablec c on (b.id2 = c.id2);

I believe this would work the same:
select * from tablea a, tableb b, tablec c where a.id = b.id and b.id2 = c.id2

There is also natural inner joins will give you a 'cleaner' output if the names are the same in the tables

to do anything further you will have to give some more info This will only return results the match the 'on' restrictions in each join.

Here is a good ref: http://en.wikipedia.org/wiki/Join_(SQL)
__________________
Vi veri veniversum vivus vici
By the power of truth, I, a living man, have conquered the universe
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On