|
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
result:
id ratey
---------- ----------
001 N
002 Y
003 N
(The number of rows affected is 3 rows) |
|