There is such a simple sign.

The task is to create a list of disciplines with the maximum number of semesters. The question is, suppose I am writing, to begin with, this is the query:
SELECT [name_subject] ,COUNT(*) AS [semesters] FROM [subject] GROUP BY [name_subject] And now I want to find the maximum number of semesters for a particular discipline (in our case 2). Writing:
SELECT MAX([semesters]) FROM ( подзапрос выше ) But for some reason, the error Invalid column name 'semesters' . Is it possible to somehow select certain columns from a table that is itself generated by another select?
Thank you in advance.