看看这段SQL语句错在哪?

来源:百度知道 编辑:UC知道 时间:2024/05/17 07:30:42
select * from
(select count(*) as cc from qy_gsm_in_day_user a,new_cdma_area_seq b,cdma_dept c
where a.dept_no=c.dept_no
and convert(varchar,active_date,112)='20061206'
and b.area=c.area
and b.area_code='53500'
union all
select count(*)
from qy_semi_in_day_user a,new_cdma_area_seq b,cdma_dept c
where a.dept_no=c.dept_no
and convert(varchar,active_date,112)='20061206'
and b.area=c.area
and b.area_code='53500')

select * from (...)
括号里面的可以正常执行结果是
count
5
13
请问为什么加了select * from(...)就会出现以下错误:
服务器: 消息 170,级别 15,状态 1,行 13
第 13 行: ')' 附近有语法错误。
实在搞不懂~不知道怎么回事啊

小问题:e.g.
select * from
(
select * from aircraft a where a.caircraft_code = \'A00001\'
) as a/* as a 中的 a 是()中表的表名“别称”而已

select a.* from (...) as a 即可

select * from (...)有这种形式的吗?`可能我知识不够~~~

按我看应该是select * from 表 where XXX=(...)吧`