How to count and check EXISTS in a table

This SQL server Transact-SQL fourm

any way try this

select Department_name, count(*) as num_of_module from Module
WHERE Modlue_code in (SELECT Module_code FROM HISTORY )

group by Department_name