SELECT ORDERID, SUM(QUANTITY) AS QUANTITY FROM [ORDERDETAILS] GROUP BY ORDERID
SELECT
TABLE_SUM_QNT.ORDERID
, TABLE_SUM_QNT.QUANTITY
FROM
(
SELECT
ORDERID
, SUM(QUANTITY) AS QUANTITY
FROM
[ORDERDETAILS]
GROUP BY
ORDERID
) AS TABLE_SUM_QNT
WHERE
TABLE_SUM_QNT.QUANTITY > 200