数据库表table里有id name banben(版本)(该列值为数字)三列
其中id唯一,name不唯一,banben不唯一,但是name和banben组合起来是唯一的,找出name=gis且banben(版本)的数值最高的行的id
SELECT ID,NAME,BANBEN
FROM TABLENAME A INNER JOIN (
SELECT MAX(BANBEN) OVER(PARTITION BY NAME ORDER BY NAME) AS MAXBANBEN,
ROWID AS RID
FROM TABLENAME
WHERE NAME = 'gis'
) B ON A.ROWID = B.RID AND A.SAL = B.MAXBANBEN