create proc up_select_student_combocondition @gradeId int, @classId int, @stuName nvarchar(10) as select s.*,c.classname,g.gradename from student s join class c on s.classid=c.classid join grade g on c.gradeid=g.gradeid where (@gradeId=-1 or g.gradeid=@gradeId) and (@classId=-1 or c.classid=@classId) and (@stuName='' or s.stuName=@stuName) go