This should do it. If CategoryNAME coming back as null, then you’re doing a LEFT OUTER join and have referential integrity issues.
CREATE PROCEDURE usp_OrderDetails_SelectByOrderId
@OrderID INT
AS
BEGIN
SELECT P.ProductId,
OD.Qty,
P.Price,
C.NAME AS CategoryNAME
FROM tblProducts P
INNER JOIN tblCategories C ON P.CategoryId = C.CategoryId
INNER JOIN tblOrderDetails OD ON P.ProductId = OD.ProductId
INNER JOIN tblOrders O ON OD.OrderId = O.OrderId
WHERE O.OrderId = @OrderId
END
3
solved How to perform complex join on three tables [closed]