select max(case when ph<=10 then ph else 9 end) from tablename group by ph
select cast(max(cast(ph as int)) as varchar) from vk_xmd where......
sorry,这样 select ph=(case when ph<=10 then ph else 9 end) from test如果取最大值 select ph=(case when ph<=10 then ph else 9 end) from test group by 分组列
sorry,这样 select ph=(case when cast( ph as int)<=10 then ph else '9' end) from test如果取最大值 select ph=(case when cast(ph as int)<=10 then ph else '9' end) from test group by 分组列
select max(convert(int,ph)) from vk_xmd where......
select convert(varchar,max(convert(int,ph))) from yourtable where condition
select ph=(case when ph<=10 then ph else 9 end) from test如果取最大值 select ph=(case when ph<=10 then ph else 9 end) from test group by 分组列
select ph=(case when cast( ph as int)<=10 then ph else '9' end) from test如果取最大值 select ph=(case when cast(ph as int)<=10 then ph else '9' end) from test group by 分组列