返回记录集中的最高值 [英] return highest value in recordset

查看:66
本文介绍了返回记录集中的最高值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在100条记录的记录集中返回最高值?

是否有必要运行2条记录集?

我希望它如此简单最高([价格]),但没有运气。


谢谢

How do you return the highest value in a recordset of maybe 100 records?
Is it necessary to run 2 recordsets?
I was hoping it was as simple as Max([Price]), but no luck.

thanks

推荐答案

SELECT TOP 10 .. ..
SELECT TOP 10 ....


shank于2004年6月25日在microsoft.public.inetserver.asp.general写道:
shank wrote on 25 jun 2004 in microsoft.public.inetserver.asp.general:
你如何回归记录集中可能有100条记录的最高值?
是否有必要运行2个记录集?
我希望它像Max([Price])一样简单,但没有运气。
How do you return the highest value in a recordset of maybe 100 records?
Is it necessary to run 2 recordsets?
I was hoping it was as simple as Max([Price]), but no luck.




如果你的意思是一个数据库:

从myField描述中选择前1个myField,myOtherField来自myTable订单





从myTable中选择max(myField)为最高


(如果你只想要那个值)

未经测试,所以我可能完全错了。


-

Evertjan。

荷兰。

(请在我的电子邮件地址中将x'变为点数)



if you mean a database:

Select top 1 myField, myOtherField from myTable order by myField Desc

or

Select max(myField) as higest from myTable

(if you only want that value)
Not tested, so I could be completely wrong.

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)




小腿 < SH *** @ tampabay.rr.com>在消息新闻中写道:OZ **************** @ tk2msftngp13.phx.gbl ...

"shank" <sh***@tampabay.rr.com> wrote in message news:OZ****************@tk2msftngp13.phx.gbl...
如何返回记录集中的最高值也许100条记录?
是否有必要运行2个记录集?
我希望它像Max([Price])一样简单,但没有运气。

谢谢
How do you return the highest value in a recordset of maybe 100 records?
Is it necessary to run 2 recordsets?
I was hoping it was as simple as Max([Price]), but no luck.

thanks




如果你想要整个记录试试:


SELECT * FROM tbl WHERE fld =(SELECT MAX(fld) )来自tbl)


更好的是,只选择你真正需要的领域。



If you want the entire record try:

SELECT * FROM tbl WHERE fld = (SELECT MAX(fld) FROM tbl)

Better yet, only select the fields you really need.


这篇关于返回记录集中的最高值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆