Click here to Skip to main content
16,007,610 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Hi friends..........
i have a table Cts with( CtsId(Pk),ClassId(Fk_Classes Table),SubjectId(Fk_Subjects Table),StaffId(Fk_Staffs Table))
tese are the columns.
And
I have another table newOne with(CtsId(Fk_Cts),DayId(Fk_DatTable),HourId(Fk_Hours))

Now I want to retrive the ClassName,StaffName,SubjectName,HourName,DayName from those tables...
ClassNAme is available in Classes Table,
StaffName is available in StaffTable,
all are lly..
i dont know how to retrive pls help me.
Posted
Updated 15-Apr-12 23:28pm
v2
Comments
shwetha1 4-Apr-12 5:58am    
I got my own answer after posting the query Thanks for all..
bbirajdar 11-Apr-12 15:02pm    
In that case you should post the solution to your own question so that any other programmer facing similar problem will be benefitted

SQL
SELECT ClassRoom.ClassName, Staff_Info.StaffId, ClassHours.HourName, Subjects.SubName, DayTable.DayName
FROM         ClassRoom INNER JOIN
                      Cst ON ClassRoom.ClassId = Cst.ClassId INNER JOIN
                      Staff_Info ON Cst.StaffId = Staff_Info.StaffId AND Cst.StaffId = Staff_Info.StaffId INNER JOIN
                      Subjects ON Cst.SubjectId = Subjects.SubjectId CROSS JOIN
                      DayTable CROSS JOIN
                      ClassHours
 
Share this answer
 
SQL
SELECT *
FROM Classes c
LEFT JOIN Staff s ON c.ClassID = s.ClassID
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900