Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 select from multiple tables

Author  Topic 

ppl1
Starting Member

5 Posts

Posted - 2006-05-13 : 05:18:32
hi,

i have created tables and i want to use a store procedure to get information from almost all of the tables...

lets say i have 4 tables - students, teachers,subjects and presence in classes.

students includes - name+phone+addresas+id

teachers includes - name+phone+degree+address+id and so on..

subjects includes- name+code+hours and so on

presence includes- id_student+id_teacher+code_subject+date and so on

now i want to create a table with all the students name , tachers name , subjects name what are in the presence table.

how can i get all of that information ? is it possible to write in one select statement?

what is right way to do it in a store procedure?

thnaks in advanced

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2006-05-13 : 05:24:52
Select Stud.Name,Teach.Name,Subj.Name From Teachers Teach Inner Join
Presence On Teach.ID =id_Teacher Inner Join Student Stud On
Stud.ID = id_Student Inner Join Subjects Subj on Subj.ID = code_subject



If Debugging is the process of removing Bugs then i Guess programming should be process of Adding them.
Go to Top of Page

ppl1
Starting Member

5 Posts

Posted - 2006-05-13 : 06:20:12
great
thanks for the help :)
Go to Top of Page
   

- Advertisement -