Je connais l'utilisation des jointures, mais parfois je me retrouve dans une situation où je ne suis pas capable de décider quelle jointure sera appropriée, une gauche ou droite.
Voici la requête où je suis bloqué.
SELECT count(ImageId) as [IndividualRemaining],
userMaster.empName AS ID#,
CONVERT(DATETIME, folderDetails.folderName, 101) AS FolderDate,
batchDetails.batchName AS Batch#,
Client=@ClientName,
TotalInloaded = IsNull(@TotalInloaded,0),
PendingUnassigned = @PendingUnassigned,
InloadedAssigned = IsNull(@TotalAssigned,0),
TotalProcessed = @TotalProcessed,
Remaining = @Remaining
FROM
batchDetails
Left JOIN folderDetails ON batchDetails.folderId = folderDetails.folderId
Left JOIN imageDetails ON batchDetails.batchId = imageDetails.batchId
Left JOIN userMaster ON imageDetails.assignedToUser = userMaster.userId
WHERE folderDetails.ClientId =@ClientID and verifyflag='n'
and folderDetails.FolderName IN (SELECT convert(VARCHAR,Value) FROM dbo.Split(@Output,','))
and userMaster.empName <> 'unused'
GROUP BY userMaster.empName, folderDetails.folderName, batchDetails.batchName
Order BY folderDetails.Foldername asc