sql问题!!!(10分)

  • 主题发起人 主题发起人 雨林^-^
  • 开始时间 开始时间

雨林^-^

Unregistered / Unconfirmed
GUEST, unregistred user!
在where 判断里如何查询最大值
如 a1表 里有两个字段 aa(月份) bb(金额)
我想列出最大月份里的金额 如
select bb from a1 where max(aa) (注意我在表里只列出金额一个字段)
但max不能在where条件里使用 请问在where条件里该用什么函数来判断最大值
 
select top 1 bb from a1 order by aa desc
 
select max(bb) as bb from a1
 
select bb from a1 where aa in (select max(aa) from a1)
 
多人接受答案了。
 

Similar threads

回复
0
查看
894
不得闲
回复
0
查看
1K
不得闲
D
回复
0
查看
2K
DelphiTeacher的专栏
D
D
回复
0
查看
1K
DelphiTeacher的专栏
D
后退
顶部