Max 单独执行和 结合group 后的不同表现
select count(*) from item_resource_bind_his;
select nvl(max(key), 1) key from item_resource_bind_his;
select nvl(max(key), 1) key
from item_resource_bind_his t
where clear_date_time is null
group by item, so_line_num, so_num, wbs_num;
重新做个测试
-- Create table
create table TEST
(
id NUMBER,
name NVARCHAR2(111)
)
;
-- Add comments to the columns
comment on column TEST.id
is '排序';
comment on column TEST.name
is '姓名';
INSERT INTO TEST(ID, NAME)VALUES(1, '张三');
INSERT INTO TEST(ID, NAME)VALUES(2, '李四');
select * from TEST t
select max(id) id from test where id = 3

浙公网安备 33010602011771号