ACCESS数据表有a,b两个字段,我要查找最大b对应的a的值.
select a from table where b=max(b);
提示错误:WHERE 子句 b=max(b)中不能有合计函数.
select a ,max(b) as c from table where b=c;
提示错误:试图执行的查询中不包含作为合计函数一部分的特定表达式'a'。 请问这条sql语句应该怎么写啊?
select a from table where b=max(b);
提示错误:WHERE 子句 b=max(b)中不能有合计函数.
select a ,max(b) as c from table where b=c;
提示错误:试图执行的查询中不包含作为合计函数一部分的特定表达式'a'。 请问这条sql语句应该怎么写啊?
declare @a int
set @a=(select max(id1) from a1)
select id from a1 where id1=@a
go
不知道各位有没有其它的方法。