SQL Query returning only one record
Alter PROCEDURE spGetRecruiterList
AS
BEGIN
SET NOCOUNT OFF;
DECLARE @TitleID as int
set @TitleID = (Select TitleID 开发者_开发问答from tblJobTitle where JobTitle = 'Recruiter')
Print @TitleID
Select p.PersonID, p.FirstName, p.MiddleName, p.LastName
from tblPerson p
INNER JOIN dbo.tblLinkTitleToPerson tp
ON p.PersonID = tp.PersonID
WHERE tp.PersonID = @TitleID
Order By p.LastName
END
GO
WHERE tp.PersonID = @TitleID
Should be
WHERE tp.TitleID = @TitleID
(probably!)
精彩评论