hi everyone.....i am the beginner of sql......can anyone help me to find out the mistake where i made????ive tried many times bt again nd again i gt same result"null value is eliminated by an aggregate or other set operation'.....my code completed successfully bt which doesnt show the result bcz of this warning message....can anyone help me??????
declare getcur cursor
for select sd.roll_no
from student_details sd
where sd.degree_id = @degree_id
AND sd.branch_id = @branch_id
open getcur
FETCH NEXT FROM getcur INTO @roll_no
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO #temp
SELECT sd.reg_no,
sd.student_name,
bd.branch_name,
cd.course_name,
r.noof_semester,
max(isnull(sm.sem_attended,0))as sem_attended,
@is_completed as is_completed,
rs.sub_code,
rs.sub_name,
case when sm.int_mark_obtained is null then 0 else @int_mark_obtained end,
case when sm.ext_mark_obtained is null then 0 else @ext_mark_obtained end,
isnull(sm.int_mark_obtained,0)+isnull(sm.ext_mark_obtained,0)as total_marks,
case when sm.exam_status='p' then 'PASS' when sm.exam_status= 'f' then 'fail' end exam_status
FROM student_details sd
INNER JOIN student_marks sm ON sd.roll_no = sm.roll_no
INNER JOIN regulation_subject rs ON rs.regulation_sub_id = sm.regulation_sub_id
INNER JOIN regulation r ON r.regulation_no= rs.regulation_no
INNER JOIN course_details cd ON cd.course_id = sm.course_id
INNER JOIN branch_details bd ON bd.branch_id=sd.branch_id
WHERE @noof_semester =(select max(@sem_attended) from student_marks sm
where sm.roll_no=@roll_no)
AND sd.roll_no = sm.roll_no
and @batch=2007 and @course_id=99
group by
sd.reg_no,
sd.student_name,
bd.branch_name,
cd.course_name,
r.noof_semester,
rs.sub_code,
rs.sub_name,
sm.int_mark_obtained,
sm.ext_mark_obtained,
sm.exam_status
if @noof_semester=max(@sem_attended)
begin
set @is_completed='yes'
end
else
begin
set @is_completed='no'
end
fetch next from getcur into @roll_no
end
select *from #temp
order by reg_no
close getcur
deallocate getcur
drop table #temp