【发布时间】:2015-06-19 01:39:18
【问题描述】:
运行此 SQL 语句时:
select TimeInterval,
((((Timer*60)/1.0)*100)/((10.0*60)/60.0)) as 'Throughput-run_1_8_11'
from StatExternalData, StatisticDefinition
where StatisticDefinition.ID=StatExternalData.StatDefId
and StatisticName='PSI_CompTran_Successful_Cnt'
order by TimeInterval asc
我收到此错误:
"select TimeInterval, ((((Timer*60)/1.0)*100)/((10.0*60)/60.0)) as 'Throughput-run_1_8_11'[*] from StatExternalData, StatisticDefinition where StatisticDefinition.ID=StatExternalData.StatDefId and StatisticName='PSI_CompTran_Successful_Cnt' order by TimeInterval asc";
expected "identifier"; [42001-185]
我发现 [*] 表示语句的哪一部分不正确,而 H2 错误代码 42001 表示 SQL 语句无效,但我数周来一直在努力想弄清楚出了什么问题,有人有想法吗?
【问题讨论】:
-
您是否尝试用双引号
" "而不是单引号 (' ') 将列别名括起来? -
另外,尽量避免使用破折号
-。尝试Throughput_run_1_8_11而不是Throughput-run_1_8_11 -
as 'Throughput-run_1_8_11'是无效的 SQL。单引号用于字符串文字。双引号用于标识符 -
感谢 barranka abd a_horse_with_no_name,这就是问题所在!