如何找到数据库中的最大值'行'Max()用于列Bt我如何在行中? [英] How Can I Find The Maximum Value In A Data Base 'Row' Max() Used In Column Bt How Can I In Row?
本文介绍了如何找到数据库中的最大值'行'Max()用于列Bt我如何在行中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
考虑这是我的表: -
id年龄SALARY
20 77 30000
10 8 50000
30 9 20000
必须查找而不使用列名,因为我们不知道哪一列包含最大值
这里我想知道第一行哪个值最大?
如何找出最大值特定行的价值?
请帮助meee
解决方案
如果你的意思是第二大值,那么试试:
WITH myTableWithRows AS (
SELECT (ROW_NUMBER() OVER ( ORDER BY myTable.Salary DESC )) as row,*
FROM myTable)
SELECT * FROM myTableWithRows WHERE row = 2
consider this is my table:-
id age SALARY
20 77 30000
10 8 50000
30 9 20000
have to find out without using column name because we don't know in which column contains the largest value
here I want know in first row which value is greatest ?
how can I find out the maximum value in particular row?
pls help meee
解决方案
If you mean the "second greatest" value, then try:
WITH myTableWithRows AS ( SELECT (ROW_NUMBER() OVER (ORDER BY myTable.Salary DESC)) as row,* FROM myTable) SELECT * FROM myTableWithRows WHERE row = 2
这篇关于如何找到数据库中的最大值'行'Max()用于列Bt我如何在行中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文