这是MySQL查询,现在我需要在动态查询下面以TERADATA SQL执行。
set l_sql=concat('SELECT max(',l_rid_col,'), MAX(cid) INTO @c2, @c3 FROM ',p_database,'.',p_table);
SET l_rid = @c2;
SET l_cid = @c3;
此更新查询:
update table_a
set row = ifnull(l_rid, 0),
column = ifnull(l_cid, 0)
where databasename = p_database
and tablename = p_table;
但是在Teradata我尝试过这样的方式:
update table_a as a
from (select max(l_rid) TR, MAX(l_cid) TCC
from DEVP.employees) as b
set a.row = b.TR, a.column = b.TCC
where a.databasename = 'DEVP'
and a.tablename = 'employees';
答案 0 :(得分:0)
我得到了答案:
file_get_contents
问题:我刚刚在UPDATE中删除了别名。终于明白了。
答案 1 :(得分:0)
请从更新语句的LHS中删除别名。 a.colA = b.colname应为colA = b.colname