如何获得最大&数据库中特定列的最小值 [英] how to get max & min values from a specific col in database

查看:91
本文介绍了如何获得最大&数据库中特定列的最小值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据库中有一个列名为最高".我在asp.net网页中有2个文本框(最大,最小)和2个按钮(最大,最小).我希望当我单击最大"按钮时,它从数据库中的该列获取最高值,并在最大"文本框中显示它.当我单击最小"按钮时,它将最小值带到该列,并在最小"文本框中显示它.记住我正在使用asp.net网页.请告诉我解决方案.如果可能,还请编写代码

i have a columns in database named highest. i have 2 textboxes(max,min) and 2 button(max, min) in asp.net web page. i want that when i click on max button it takes the highest values from that column in database and show it in max text box. when i click on min button it takes the minimum value to that column and show it in min text box. remember i am using asp.net web page.please tell me the solution.also code if possible

推荐答案

是的,很好-您正在编码一个ASP.Net网页.但是:

0)您要从数据库还是从数据库中检索到的数据中获取此信息?

1)您使用的是哪种语言? C#或VB?
Yeah, that''s nice - you''re coding an ASP.Net web page. But:

0) Do you want to get this info from the database, or from data you''ve already retrieved from the database?

1) What language are you using? C#, or VB?




首先,请更具体地说明您实际使用的语言(语言,数据库).还请务必声明您自己已经尝试过的内容,因为codeproject.com是一个支持平台,而不是其他人来做我的工作"平台.

无论如何,这是您的一些起点,如何从SQL DB中获取min/max值:

TSQL MAX命令: http://msdn.microsoft.com/en-us/library/ms187751.aspx [^ ]
TSQL MIN命令: http://msdn.microsoft.com/en-us/library/ms179916.aspx [ ^ ]

用于获取max/min值的SQL查询看起来像这样:

Hi,

First, please be more specific in what you actually using (language, DB). Also always state what you already tried by yourself, because codeproject.com is a supporting-platform and not a "others do my work"-platform.

Anyway, here are some starting points for you, how you could get the min / max values out of a SQL DB:

TSQL MAX Command: http://msdn.microsoft.com/en-us/library/ms187751.aspx[^]
TSQL MIN Command: http://msdn.microsoft.com/en-us/library/ms179916.aspx[^]

The SQL Query for getting a max / min value could look like this:

SELECT MAX(MyColumn1), MIN(MyColumn2)
FROM tbl_MyTable



如果您不知道如何使用ASP.NET访问SQL DB,则可以从以下内容开始:
为初学者使用ADO.NET [



If you do not know how to access a SQL DB using ASP.NET, you could start with something like this:
Using ADO.NET for beginners[^]

Hope this helps to solve your problem.

Happy coding and have a nice weekend,
Stops


这篇关于如何获得最大&数据库中特定列的最小值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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