您可使用<代码>row_ number() 类似内容。
declare @g geography;
set @g = geography::STGeomFromText( LINESTRING(-122.360 47.656, -122.343 47.656) , 4326);
declare @T table
(display_name varchar(10), geo_location geography)
insert into @T values ( 1 , @g)
insert into @T values ( 1 , @g)
insert into @T values ( 1 , @g)
insert into @T values ( 2 , @g)
insert into @T values ( 2 , @g)
select display_name, geo_location
from
(
select *,
row_number() over(partition by display_name, geo_location.ToString() order by (select 0)) as rn
from @T
) as T
where rn = 1
结果:
display_name geo_location
------------ --------------------------------------------------------------------------------
1 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
2 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0