sql 不能轻易完成的功能?
a | b | c
1000262 | 0.75449 | 2376.6471
1000262 | 0.74117 | 2267.7307
1000262 | 0.74556 | 2267.7191
1000262 | 0.74556 | 2267.7191
在foxpro中:
selec a,b,c from chkdb group by 1 where a =1000262
a | b | c
1000262 | 0.74556 | 2267.7191
结果可以选择出一条。而且总是最后一条。
请问同样的功能在sql server上如何简单实现。
推荐阅读
select * ,identity(int, 1,1) as id
into #temp from chkdb
select * from #temp where id in (select max(id) from #temp group by a )
我觉得你使用的vfp一定是7.0版本以前的,因为7.0以后已经不能用上述方法了,而且会出错,也就是group by 的使用方法与在ms sqlserver中一致了,你必须这样写
select a,b,c from chkdb group by a,b,c where a=1000262,所以我觉得这会不会是早期vfp的一个bug呢?


讨论区