Results 1 to 4 of 4
  1. #1
    Join Date
    Jul 2008
    Posts
    4

    Unanswered: 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.

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    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

  3. #3
    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.....

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •