クエリを実行しようとしましたが、データが 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
間違いはどこですか?