max是sql聚合函数,不像一般函数那样可被孤立地使用,它需针对一个行集(一张表或查询)进行计算才能返回唯一一条结果。
题主可以试一下这样写:
select case when version=
(select max(version) from t1) then projectno end from t1;
又或者
select case when a.version=b.maxversion then
a.projectno end from t1 a,
(select max(version) as maxversion from t1) b;
先用where条件获取version最大的数据,然后想干什么干什么