我正在使用此代码从该数据库中提取信息。然而,它向我显示了这个错误:
错误:Teradata prepare:语法错误,字符串或Unicode字符文字与单词之间应为类似"("的内容"d"。SQL语句为:WITH vmher102ult as(select cod_te,max(fec_consulta(as max_fec_consulta fromklarmxpw_her.vmher102,其中cod_te不在(","0","00000000"(中并且fec_consulta>='01MAR2021’d按cod_te分组(选择t1*从klarmxpw_her.vmher101作为t1内部连接vmher102ult作为t1上的t2t1.fec_consulta=t2.max_fec_consulta.
我用于此传递的代码如下:
proc sql;
connect to teradata as tera (user=&tuser. password=&tpass. server='TDMX03');
create table vmher101_m as
select * from connection to tera (
WITH vmher102ult as (
select cod_cte, max(fec_consulta) as max_fec_consulta
from klarmxpw_her.vmher102
where cod_cte not in ('','0','00000000')
and fec_consulta>='01MAR2021'd
group by cod_cte)
select t1.*
from klarmxpw_her.vmher101 as t1
inner join vmher102ult as t2
on t1.cod_cte=t2.cod_cte and t1.fec_consulta=t2.max_fec_consulta);
disconnect from ter;
有人知道我能做什么吗?
您需要在from connection to tera
之后的((中使用TERADATA代码。
尝试
and fec_consulta>= DATE '2021-03-01'
Teradata文档