您可以使用
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_locationfrom ( select *,row_number() over(partition by display_name, geo_location.ToString() order by (select 0)) as rn from @T ) as Twhere rn = 1
结果:
display_name geo_location------------ --------------------------------------------------------------------------------1 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC02 0xE610000001148716D9CEF7D34740D7A3703D0A975EC08716D9CEF7D34740CBA145B6F3955EC0
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)