the below is my join query for getting some result
create procedure sp_bindexamclass(@classid int,@examid int) as begin select en.ExamName,St.Standered_name,Sr.SubjectName,ec.Maximummark,ec.Minimummark from Standered_details St inner join ExamClasssetting_details ec on St.Standered_id=ec.Classid inner join SubjectRegistration_details Sr on Sr.SubjectCode=ec.subjectid inner join ExamNameSetting_details en on en.ExamId=ec.ExamId where ec.Classid=@classid and ec.ExamId=@examid end
Table relation is
1.standered details
relational key is
standered_idto
classid(fk) of Examclasssetting_details
2.SubjectRegistration_details
relational key is
subjectcodeto
subjectidof
Examclasssetting_details
3 .ExamNamesetting_details
relational key is
ExamIdto
ExamIdof Examclasssetting_deatails
all the table contains data for join query. but i couldnt get the desired result. what is the problem in join query.
Deepak VermaPosted Dec 16, 2012, 11:16 PM
If you still don't find solution, plz upload schema and data of tables used in the query.
baskaran chellasamyPosted Dec 10, 2012, 1:09 AM
pradeep kumarPosted Dec 9, 2012, 2:39 PM
I think it's datatype error...,
as
begin
selecten.ExamName,St.Standered_name,Sr.SubjectName,ec.Maximummark,ec.Minimummarkfrom Standered_details St
inner join ExamClasssetting_details ec onSt.Standered_id=ec.Classid
inner join SubjectRegistration_details Sr onSr.SubjectCode=ec.subjectid
inner join ExamNameSetting_details en onen.ExamId=ec.ExamId
where ec.Classid=@classid
and ec.ExamId=@examid
end
inner join SubjectRegistration_details Sr onSr.SubjectCode=ec.subjectid
here i think u r trying to equal int=string...., data type of subjectcode...,?