我有一个方案...
我有一个名为sample的表,该表具有三列:
id, name, address
其中id是唯一的自动增量列。这是我的数据:
id名称地址1约翰·洛杉矶2彼得。 VS
我的下一列将是3, 'smith', 'vegas'
我尝试过这样:
insert into sample select c1 as id from (select max(id)+1) c1, 'smith' as name , 'vegas' as address;
获取Error: Error compiling statement: FAILED: SemanticException Error in parsing (sttae=402000,code=40000)
我已经尝试使用udf作为自动增量列,但是没有运气。
可能是语法问题。由于我没有蜂巢实例可以尝试,
这项工作吗?
insert
into sample
select max(id)+1 c1
,max('smith') as name
,max('vegas') as address
from sample