The main query
select case when
aCalculatedDatefield > XMONTH then 1 else null
end as V
from
( some nested queries where the aCalculatedDatefield is created)
and I want to run it for some months in year 2022
select XMONTH from year2020 where XMONTH = condition
that returns more than one value
The result should be sth like
+--------------------------------------
Month | V
+--------------------------------------
JAN | 1
+--------------------------------------
APR | null
+--------------------------------------
I think this query should be run with cross join, but I don't know how to use XMONTH
from the second query in the main query in SQL Server.