conditional/processing on the dummy data column to create new dummy column Following is my query.

Select [A],[C]
      ,CASE WHEN [A]&gt;19999 and [A]&lt;30000 THEN '12' ELSE '21' END AS 'dummy1'
    ,Substring(CAST(C AS varchar(9)),1,4) as YEARDummy
    ,Substring(CAST(C AS varchar(9)),5,2) as MONTHDummy
    ,Substring(CAST(C AS varchar(9)),7,2) as DAYDummy
    ,CASE WHEN MONTHDummy&gt;0 and DAYDummy&lt;31 THEN '30dayas' ELSE 'xyz' END AS Dummy4
From TableYearlyData


I want to do conditional/processing on the dummy data column to create new dummy column. How can I use a dummy column to create a new dummy column?
with the help of CTE

;WITH CTE AS (Select [A],[C]
      ,CASE WHEN [A]&gt;19999 and [A]&lt;30000 THEN '12' ELSE '21' END AS 'dummy1'
    ,Substring(CAST(C AS varchar(9)),1,4) as YEARDummy
    ,Substring(CAST(C AS varchar(9)),5,2) as MONTHDummy
    ,Substring(CAST(C AS varchar(9)),7,2) as DAYDummy
    --,CASE WHEN MONTHDummy&gt;0 and DAYDummy&lt;31 THEN '30dayas' ELSE 'xyz' END AS Dummy4
From TableYearlyData)

-- here you can apply your CASE with YEARDummy,MONTHDummy,DAYDummy column
SELECT *,CASE WHEN MONTHDummy&gt;0 and DAYDummy&lt;31 THEN '30dayas' ELSE 'xyz' END AS Dummy4 
FROM CTE