Since you are learning - lets go over a few items in this query. The first is using table aliases - this will make the query easier to manage, second is formatting, third would be using the GUI to build queries - it has many issues and it is just easier to write the queries directly in a new query window, and finally - using functions in the where clause.
Here is the query reformatted:
SELECT soh.SalesOrderNo
, soh..OrderDate
, sod.QuantityOrdered
, soh.UDF_NEWHIRE
, soh.UDF_EDIT
, soh.UDF_NEWDESIGN
, soh.UDF_OLDDESIGN
, soh.UDF_SHIPBYDATE
, soh.UDF_NEEDDATE
, soh.UDF_EVENTDATE
, soh.UDF_DATE_PRODUCTION_RECEIVED
, soh.UDF_DATE_PRODUCTION_COMPLETED
, soh.OrderType
, soh.UDF_MONOGRAMING
FROM dbo.SO_SalesOrderHeader AS soh
INNER JOIN dbo.SO_SalesOrderDetail AS sod ON sod.SalesOrderNo = soh.SalesOrderNo
WHERE LEFT(sod.ItemCode, 5) <> '/INST'
AND soh.UDF_MONOGRAMING = 'Y'
AND (
soh.OrderType = 'S'
OR soh.OrderType = 'B'
)
AND soh.UDF_DATE_PRODUCTION_RECEIVED <> CONVERT(DATETIME, '1753-01-01 00:00:00', 102)
So - this query gives us all of the QuantityOrdered for each Order. You want to total that - so we need to add a GROUP BY. You want to group by all columns in the select list that are not aggregated - and since the only thing you want aggregated is the QuantityOrdered then you will group by all columns except that one:
SELECT soh.SalesOrderNo
, soh..OrderDate
, TotalQuantityOrdered = SUM(sod.QuantityOrdered)
, soh.UDF_NEWHIRE
, soh.UDF_EDIT
, soh.UDF_NEWDESIGN
, soh.UDF_OLDDESIGN
, soh.UDF_SHIPBYDATE
, soh.UDF_NEEDDATE
, soh.UDF_EVENTDATE
, soh.UDF_DATE_PRODUCTION_RECEIVED
, soh.UDF_DATE_PRODUCTION_COMPLETED
, soh.OrderType
, soh.UDF_MONOGRAMING
FROM dbo.SO_SalesOrderHeader AS soh
INNER JOIN dbo.SO_SalesOrderDetail AS sod ON sod.SalesOrderNo = soh.SalesOrderNo
WHERE sod.ItemCode NOT LIKE '/INST%'
AND soh.UDF_MONOGRAMING = 'Y'
AND soh.OrderType IN ('S', 'B')
AND soh.UDF_DATE_PRODUCTION_RECEIVED <> CONVERT(DATETIME, '1753-01-01 00:00:00', 102)
GROUP BY soh.SalesOrderNo
, soh..OrderDate
, soh.UDF_NEWHIRE
, soh.UDF_EDIT
, soh.UDF_NEWDESIGN
, soh.UDF_OLDDESIGN
, soh.UDF_SHIPBYDATE
, soh.UDF_NEEDDATE
, soh.UDF_EVENTDATE
, soh.UDF_DATE_PRODUCTION_RECEIVED
, soh.UDF_DATE_PRODUCTION_COMPLETED
, soh.OrderType
, soh.UDF_MONOGRAMING
I modified the WHERE clause - removing the LEFT function and using NOT LIKE instead. That may perform better if an index can be used. I also used IN for the OR criteria - simplifies the query and I removed all of the extra parentheses.
I then added a SUM for the QuantityOrdered and named that column as TotalQuantityOrdered.
If you need to add additional columns from the detail - they can be added using an appropriate aggregate. For example, if you also want to show the total number of detail line then you could add: TotalLines = COUNT(*).