I have this query and I know I need to use alias's but I thought I had it working good. Today I found a "SalesOrder" with two records of the same "itemcode" ex. It has two lines on the order with "itemcode" = IGR7-3XL LON. In my query the result is only producing one line with the IGR7-3XL LON. Is this a join issue?
Source records the second column shows the two records as unique
SELECT TOP (100) PERCENT dbo.SO_SalesOrderDetail.SalesOrderNo, dbo.SO_SalesOrderDetail.ItemCode, dbo.SO_SalesOrderDetail.QuantityOrdered, dbo.SO_SalesOrderDetail.QuantityBackordered,
dbo.SO_SalesOrderDetail.UDF_QTY_PULLED, dbo.SO_SalesOrderDetail.UDF_QTY_RECEIVED, dbo.SO_SalesOrderDetail.UDF_PROCESSED_IC, dbo.SO_SalesOrderHeader.UDF_PROCESS_INCOMPLETE,
dbo.SO_SalesOrderHeader.UDF_ALLOCATED, dbo.SO_SalesOrderDetail.WarehouseCode, dbo.SO_SalesOrderHeader.UDF_DATE_ALLOCATED
FROM dbo.SO_SalesOrderDetail INNER JOIN
dbo.SO_SalesOrderHeader ON dbo.SO_SalesOrderDetail.SalesOrderNo = dbo.SO_SalesOrderHeader.SalesOrderNo
WHERE (dbo.SO_SalesOrderHeader.OrderType = 'S' OR
dbo.SO_SalesOrderHeader.OrderType = 'B') AND (dbo.SO_SalesOrderDetail.ItemType = '1')
GROUP BY dbo.SO_SalesOrderDetail.ItemCode, dbo.SO_SalesOrderDetail.SalesOrderNo, dbo.SO_SalesOrderDetail.QuantityOrdered, dbo.SO_SalesOrderDetail.QuantityBackordered, dbo.SO_SalesOrderDetail.UDF_QTY_PULLED,
dbo.SO_SalesOrderDetail.UDF_QTY_RECEIVED, dbo.SO_SalesOrderDetail.UDF_PROCESSED_IC, dbo.SO_SalesOrderHeader.UDF_PROCESS_INCOMPLETE, dbo.SO_SalesOrderHeader.UDF_ALLOCATED,
dbo.SO_SalesOrderDetail.WarehouseCode, dbo.SO_SalesOrderHeader.UDF_DATE_ALLOCATED
HAVING (dbo.SO_SalesOrderDetail.WarehouseCode = '000')
ORDER BY dbo.SO_SalesOrderDetail.SalesOrderNo