我想从特定部分和其他搜索条件中获取学生列表。我正在这样做:-
declare @sectionId int, @name varchar
select @sectionId=23
select @name='a'
select UserId, FirstName from StudentMaster
Where FirstName Like @name and UserId IN
(
select UserId from StudentMaster
Intersect
select StudentId from StudentInSections where SectionId=@sectionId
)
但它没有给出正确的答案。如果我只写 Userid 条件,它可以正常工作,但我必须得到包含整个搜索条件的列表。有人帮我吗?