select k.Val, sum(k.Cnt) "Cnt" from
(
(select a.Env_Location "Val", count( a.VolumeID ) "Cnt"
from DTree
join ZCOP_APLNG_Documents a on
DTree.DataID = a.DataID and DTree.VersionNum = a.VersionNum
where
DTree.OwnerID = -2111 and
DTree.SubType not in ( 0, 136 ) and
a.Env_Location is not NULL
group by a.Env_Location
)
union
(select
b.Env_Location "Val", count( b.VolumeID ) "Cnt"
from DTree
join ZCOP_APLNG_Corr b on
DTree.DataID = b.DataID and DTree.VersionNum = b.VersionNum
where
DTree.OwnerID = -2111 and
DTree.SubType not in ( 0, 136 ) and
b.Env_Location is not NULL
group by b.Env_Location
)
) k
group by k.Val
誰でも私がこの仕事をするのを手伝ってくれますか? Val または Cnt のエラーを表示すると、無効な識別子です。列にいくつかの列エイリアスを使用できませんか??