Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Appending Query

kellodykellody Member Posts: 11
Hi I have two tables. . For simplicity's sake . .

Teachers Students
T_First S_First
T_Middle S_Middle
T_Last S_Last
T_Course T_GPA

I want to make a table or a view (either is fine) of all the people in my school (students and teachers). . How do I do that. All I really want is the first and last name of everybody in the school.

Comments

  • veluguvelugu Member Posts: 3
    : Hi I have two tables. . For simplicity's sake . .
    :
    : Teachers Students
    : T_First S_First
    : T_Middle S_Middle
    : T_Last S_Last
    : T_Course T_GPA
    :
    : I want to make a table or a view (either is fine) of all the people in my school (students and teachers). . How do I do that. All I really want is the first and last name of everybody in the school.
    :

    Hello

    Try these statements

    select T_First,T_Last into AllPeople from Teachers
    go
    insert AllPeople Values
    select S_First,S_Last from Students

    (the first statement creates and adds the selected rows...)
    ( the second statement only adds the selected rows)

    HTH
    velugu


  • GideonOmegaGideonOmega Member Posts: 617
    : : Hi I have two tables. . For simplicity's sake . .
    : :
    : : Teachers Students
    : : T_First S_First
    : : T_Middle S_Middle
    : : T_Last S_Last
    : : T_Course T_GPA
    : :
    : : I want to make a table or a view (either is fine) of all the people in my school (students and teachers). . How do I do that. All I really want is the first and last name of everybody in the school.
    : :
    :
    : Hello
    :
    : Try these statements
    :
    : select T_First,T_Last into AllPeople from Teachers
    : go
    : insert AllPeople Values
    : select S_First,S_Last from Students
    :
    : (the first statement creates and adds the selected rows...)
    : ( the second statement only adds the selected rows)
    :
    : HTH
    : velugu
    :
    :
    :


    or try this
    [code]
    select t.T_First, t.T_Last, s.S_First, s.S_Last
    from teachers t
    inner join students
    on t.teacherID = s.TeacherID
    [/code]
    to do this you would make a teacher id as the primary key in the teachers table and then for every student under that teacher you would put the teacher id.
Sign In or Register to comment.