HI
I have a query I am trying to fit together. The Works Order as 3 stages signified by linetype field which can be 1 ,2 or 3.
My first query brings in all 3 rows. S you can see ProductID does not have a ProductID
But however I need to add in product Information so in my second query I only get 2 lines. I need however the type 2 row to show even if as just NULLS. Any ideas what i can do to the code to make this row show.
I have a query I am trying to fit together. The Works Order as 3 stages signified by linetype field which can be 1 ,2 or 3.
My first query brings in all 3 rows. S you can see ProductID does not have a ProductID
But however I need to add in product Information so in my second query I only get 2 lines. I need however the type 2 row to show even if as just NULLS. Any ideas what i can do to the code to make this row show.
SQL:
SELECT
dbo.WorksOrderLine.ProductID,
dbo.Product.ProductCode,
dbo.Product.Description,
dbo.WorksOrderHeader.WorksOrderID,
dbo.WorksOrderHeader.WorksOrderNumber,
dbo.WorksOrderHeader.DateTimeProcessed,
dbo.Product.Thickness,
dbo.Product.Width,
dbo.Product.Length,
dbo.Product.DefaultPiecesPerPack,
dbo.WorksOrderLine.LineType
FROM dbo.WorksOrderHeader INNER JOIN
dbo.WorksOrderLine ON dbo.WorksOrderHeader.WorksOrderID = dbo.WorksOrderLine.WorksOrderID INNER JOIN
dbo.Product ON dbo.WorksOrderLine.ProductID = dbo.Product.ProductID INNER JOIN
dbo.[148-vwWOSourceProductPlantCP1] ON dbo.WorksOrderHeader.WorksOrderID = dbo.[148-vwWOSourceProductPlantCP1].WorksOrderID
GROUP BY dbo.WorksOrderHeader.WorksOrderID, dbo.WorksOrderLine.LineType, dbo.WorksOrderLine.ProductID, dbo.WorksOrderHeader.WorksOrderNumber, dbo.Product.ProductCode, dbo.Product.Description,
dbo.Product.Deleted, dbo.WorksOrderHeader.DateTimeProcessed, dbo.Product.DefaultPiecesPerPack, dbo.Product.Thickness, dbo.Product.Width, dbo.Product.Length
HAVING (dbo.Product.Deleted = 0) AND (dbo.WorksOrderHeader.WorksOrderNumber = 299925)
ORDER BY dbo.Product.ProductCode, dbo.WorksOrderHeader.DateTimeProcessed DESC