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 > Database Server Software > DB2 > selecting from multiple tables

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-10-08, 11:02
Djave Djave is offline
Registered User
 
Join Date: Jul 2008
Posts: 4
selecting from multiple tables

Hi all,
i have three tables:
table 1 has two colomns: name and id
table 2 has two columns: countrycode and id(id in this table is the forgin key from table one)
table 3 has two columns: countryname and countrycode(countrycode is the forggin key from table two)

now i have to make a query to select the name from table one and the countryname that belongs to that name from table three .
can anyone help me to make this query???

Thanx.
Reply With Quote
  #2 (permalink)  
Old 07-10-08, 11:51
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
This is rather basic SQL. So rather than supply you with the answer, I am going to let you figure it out yourself. I will give you this link to a "DB2 SQL cookbook" that will help you on your journey.

http://mysite.verizon.net/Graeme_Birchall/id1.html

Andy
Reply With Quote
  #3 (permalink)  
Old 07-11-08, 04:36
nick.ncs nick.ncs is offline
Registered User
 
Join Date: May 2007
Location: somewhere in dbforums
Posts: 221
Agree with Andy....

You will have look at topics related to JOINS ( INNER | LEFT | RIGHT ) to be more precise.....
Reply With Quote
  #4 (permalink)  
Old 07-11-08, 22:32
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Does this mean that the 2nd session of summer school has started?
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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