1

我可以通过这个查询选择最后一条记录

select first 1 idt from table1 order by id desc;

但我想在informix的表末尾添加一条记录(id ++)

4

1 回答 1

2

如果我理解正确,您需要 Informix 中的一SERIAL。这是一个在您添加新值时自动增加的列。

因此,该表应定义为:

create table table1 (
    id serial primary key,
    . . .
);

然后,当您进行插入时,请省略id

insert into table1 ( . . . )  -- all but id
    values ( . . . );

id自动递增并与数据一起插入。

于 2019-05-04T11:28:28.663 回答