Making a report using SQL

Hi.

I'm very new and uneducated when it comes to SQL.
I'm trying to make a report in our program that contains orders.
I need to get the report to count all orders that contains both article 200 and 228, but I can only get it to count all orders that gave either not both.

Any help for this noob would be appreciated very much!

SELECT COUNT(*) AS order_count
FROM (
    SELECT order_number
    FROM dbo.table_name
    GROUP BY order_number
    HAVING MAX(CASE WHEN article = '200' THEN 1 ELSE 0 END) = 1 AND
        MAX(CASE WHEN article = '228' THEN 1 ELSE 0 END) = 1
) AS derived
1 Like

Thank you!

You're welcome!