SQL分组排序问题
摘要:3个字段ABC要挑出以A分组C第n大的行 开始是想先取TOP n - 1,然后取不在这TOP n – 1 中的TOP1就是第N个了,比较麻烦。 后来有猛人解答: select * from t t1 where (select count(*) from t where t1.A = t.A and t1.c<=t.c) = n 就可以取到以A分组每组的第n大(t为表...
阅读全文
posted @
2006-09-09 13:43
aiya
阅读(1632)
推荐(0) 编辑