Select from union of nested subqueries
<p>I am quite certain this is an issue with applying proper aliases, I'm just not sure where I'm going wrong.  I am looking at the following UNION in sqlserver:</p>

<pre><code>Select Z.DesiredResult1, etc...
from (
    Select C.columns
        from (
        Select B.columns
            from (
                Select A.columns
                from (Subquery) as A
            ) as B
        ) as C
    Where C.condition = 1
    UNION
    Select F.columns
        from (
        Select E.columns
            from (
                Select D.columns
                from (Subquery) as D
            ) as E
        ) as F
    Where F.condition = 2
) as Z
</code></pre>

<p>The union by itself functions perfectly, but when trying to make <code>SELECT</code> statements from it (as shown above) it throws an error: </p>

<blockquote>
  <p>No column name was specified for column 1 of 'Z'</p>
</blockquote>

<p>Any insights would be appreciated, thanks for helping an SQL newbie.</p>

<p>Edit:  Solved--I misunderstood the error.  The issue was an aggregate function that needed an alias, not an entire subquery.  Leaving the aggregate column unnamed worked fine for the union alone, so I didn't even consider it.  Thanks for bothering to read.</p>