|
It is estimated that the landlord means not to do according to the order.
How about:
--Build an example table:
create table #ddd
([id] int,[name] varchar(20),remark varchar(200)
)
insert into #ddd
select 1,'a','dsfadsf'
union
select 2,'b','dryh'
union
select 3,'c','uui'
union
select 4,'d','gjk'
union
select 5,'e','dsfradsf'
union
select 6,'f','dsfadsf'
union
select 7,'g','fdf'
union
select 8,'h','dfdf'
union
select 9,'i','jki'
union
select 10,'j','reta'
--check sentence
select * from
(
select top 8 a.* from (select * from #ddd) a
union all
select top 4 b.* from (select * from #ddd) b
) c
group by [id],[name],remark
having count(*)=1 |
|