Use the code="sql" IfCode on the left, like so. Dwain's right, I flipped the order for having/group by, need to put it after.
SELECT
O.OrderID,
O.Pieces,
PA.OrderID,
COUNT(PA.OrderID) AS TotalParcels,
COUNT(*) AS 'TotalParcels'
FROM
tblParcelAssigned as PA
INNER JOIN
tblOrder AS O
ONO.OrderID = PA.OrderID
WHERE
PA.Type = 2
GROUP BY
O.OrderID,
O.Pieces,
PA.OrderID
HAVING
o.Pieces <> Count(*)
ORDER BY
PA.OrderID
DESC
Never stop learning, even if it hurts. Ego bruises are practically mandatory as you learn unless you've never risked enough to make a mistake.
For better assistance in answering your questions[/url] | Forum Netiquette
For index/tuning help, follow these directions.[/url] |Tally Tables[/url]
Twitter: @AnyWayDBA