|
发表于 2020-10-16 11:45:01
|
显示全部楼层
declare @a table(id char(10),ratey char(10))
insert into @a select '001','Y' UNION ALL
SELECT '001','N' UNION ALL
SELECT '002','Y' UNION ALL
SELECT '002','Y' UNION ALL
SELECT '003','N' UNION ALL
SELECT '003','N'
select id,min(ratey) as ratey from @a group by id
结果:
id ratey
---------- ----------
001 N
002 Y
003 N
(所影响的行数为 3 行) |
|