SQL2005 报错 在关键字'group' 附近有语法错误select a,b,sum(x) from (select a,b,'1' as x from aaaunion allselect a,b,'-1' as x from bbb)group by a,b改成下面这样还是同样报错:select a,b,sum(x) from (select a,b,'1' as x from aaa
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/27 17:36:51
SQL2005 报错 在关键字'group' 附近有语法错误select a,b,sum(x) from (select a,b,'1' as x from aaaunion allselect a,b,'-1' as x from bbb)group by a,b改成下面这样还是同样报错:select a,b,sum(x) from (select a,b,'1' as x from aaa
SQL2005 报错 在关键字'group' 附近有语法错误
select a,b,sum(x) from (
select a,b,'1' as x from aaa
union all
select a,b,'-1' as x from bbb)
group by a,b
改成下面这样还是同样报错:
select a,b,sum(x) from (
select a,b,'1' as x from aaa
)
group by a,b
同样的语句我再oracle9中就能执行,在SQL2005中执行就报错,请问有什么问题?
SQL2005 报错 在关键字'group' 附近有语法错误select a,b,sum(x) from (select a,b,'1' as x from aaaunion allselect a,b,'-1' as x from bbb)group by a,b改成下面这样还是同样报错:select a,b,sum(x) from (select a,b,'1' as x from aaa
select a,b,sum(x) from (
select a,b,'1' as x from aaa
union all
select a,b,'-1' as x from bbb) xx --注意看这里 多了一个别名xx
group by a,b
改成这样 为 from 后面的子查询指定一个名字 这里用的xx 你可以自己改一个