go
if object_id('[TBL]') is not null
drop table [TBL]
go
create table [TBL](
[ID] int,
[经度] numeric(4,1),
[纬度] numeric(3,1)
)
go
insert [TBL]
select 1,116.1,36.1 union all
select 2,116.2,36.1 union all
select 3,116.2,36.1 union all
select 4,116.2,36.1 union all
select 5,116.3,36.1 union all
select 6,116.2,36.1
;WITH T
AS
(
SELECT *,ROW_NUMBER()OVER(ORDER BY GETDATE()) AS NUM,
ROW_NUMBER()OVER(PARTITION BY [经度],[纬度] ORDER BY [ID] ) AS [ORDER]
FROM [TBL]
)
SELECT [ID],[经度],[纬度] FROM T WHERE [ORDER]=1
UNION
SELECT [ID],[经度],[纬度] FROM T WHERE ID-[ORDER]<>1
希望你能看懂我的
group by distinct 为什么不用??
你想看电视。就去买个电视或者电脑。
你告诉别人,我能不能不用电视或者电脑看。
方式和工具而已。
按照你现有的需求,只能是多行。
你的需求不明确,
你已经说过了,B中就是多行,可是你现在又想只显示一样,那么依据是什么?你取哪一行?