sql语句错在哪里?
各位高手,小弟有段sql语句如下:
create table scu50.tmp1 as
(
select
distinct(trim(Z13_TITLE)) TITLE,
substr(Z13_ISN,1,15) ISN,
trim(tmp.NO) NO,
sum(tmp.TIMES)TIMES
from
tmp,Z13
where Z13_REC_KEY =tmp.RECKEY
group by Z13_TITLE,substr(Z13_ISN,1,15),tmp.NO
order by TITLE
);
临时表内的sql语句,单独执行时正确,但创建临时表时就总提示:“order by”前面缺失右括号,这是什么原因呢,各位大哥!
------解决方案--------------------create table scu50.tmp1 as
select
distinct(trim(Z13_TITLE)) TITLE,
substr(Z13_ISN,1,15) ISN,
trim(tmp.NO) NO,
sum(tmp.TIMES)TIMES
from
tmp,Z13
where Z13_REC_KEY =tmp.RECKEY
group by Z13_TITLE,substr(Z13_ISN,1,15),tmp.NO
order by trim(Z13_TITLE) ;
as后面的括号去掉
------解决方案--------------------恩。。。对头。。。