我尝试执行查询,但它显示数据超过 5 次。这是我使用的查询
ALTER procedure [dbo].[dddddd]
@userid int
as
SELECT DocumentInfo.DocID as DocumentID,
dbo.DocumentInfo.DocName as DocumentName,
dbo.DocumentInfo.Uploadfile as FileUploaded,
dbo.DocType.DocType as Document,
dbo.Department.DepType as Department,
dbo.ApproveType.ApproveType AS ApproveID
FROM dbo.DocumentInfo
inner JOIN dbo.DocType ON dbo.DocumentInfo.DocTypeID=dbo.DocType.DocTypeID
inner JOIN dbo.Department ON dbo.DocumentInfo.DepID=dbo.Department.DepID
LEFT JOIN dbo.ApproveType ON dbo.ApproveType.approveid=dbo.Department.DepID
LEFT OUTER JOIN Approval a ON a.DocID = a.DocID
JOIN ApproveType at ON at.ApproveID = ISNULL(a.Approveid, 3)
where UserID=@userid
看到这个结果。。
DocumentID DocumentName FileUploaded Document Department ApproveID
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
8 SDASDASD dsfsdf.docx MSWord Human Resource NULL
9 dr reprt n analysis HR.docx MSWord Human Resource NULL
9 dr reprt n analysis HR.docx MSWord Human Resource NULL
9 dr reprt n analysis HR.docx MSWord Human Resource NULLL
9 dr reprt n analysis HR.docx MSWord Human Resource NULL
9 dr reprt n analysis HR.docx MSWord Human Resource NULL
10 hr report HR.docx MSWord Human Resource NULL
10 hr report HR.docx MSWord Human Resource NULL
10 hr report HR.docx MSWord Human Resource NULL
10 hr report HR.docx MSWord Human Resource NULL
错误在哪里?