SELECT *
FROM [SELECT *,(select count(*) from 表1 where a.mz=mz and a.sl>sl) as dd
FROM 表1 a order by 3,mz]. AS [%$##@_Alias]
WHERE dd=1;
2
SELECT mz, min(sl)
FROM [select a.* from 表1 a inner join (
select mz,min(sl) as msl from 表1 group by mz) b on a.mz=b.mz and a.sl>b.msl]. AS [%$##@_Alias]
GROUP BY mz;
SELECT *
FROM 表1 AS a1
WHERE sl =(select top 1 sl from (SELECT *
FROM 表1 AS a
WHERE sl in(select top 2 sl from 表1 where a.mz=mz order by sl)
) where a1.mz=mz order by sl desc);
select * from (
SELECT (select count(*) from 表1 where sl<=a.sl and mz=a.mz) AS js, *
FROM 表1 AS a
ORDER BY a.MZ, a.SL) where js=2
通过对JS=进行操作,可取出第N个最小数,