#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2013
    Posts
    1
    Rep Power
    0

    Query help needed.


    Need help w/ a join, or multiple table query.
    I need to show school id, school name, team name.
    The tables:
    Code:
    SQL> desc team
     Name
     ----------------
     TEAM_ID
     SPORT_ID
     SCHOOL_ID
     TEAM_NAME
    
    SQL> desc school
     Name
     ----------------
     SCHOOL_ID
     SCHOOL_NAME
     SCHOOL_TYPE
    What I've tried:
    Code:
    SQL> select school.school_name, team. team_name
      2  where team.school_id=school.school_id
      3  from school,team;
  2. #2
  3. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,534
    Rep Power
    1906
    You did not received any error message? When you make a post please include the error messages you receive.

    In your SQL, FROM should be be placed after SELECT.

    when joining tables, you should use the explicit JOIN syntax, instead of the implicit FROM table1,table2, ....

    sql Code:
     
    SELECT school.school_id, school.school_name, team.team_name
    FROM school
    INNER JOIN team ON team.school_id=school.school_id

IMN logo majestic logo threadwatch logo seochat tools logo