I want to verify the Max value of int with the column value is it possible?
eg:- select * from table_name where column_name= Max(int)
我想用列值验证int的Max值是否可能?例如: - select * from table_name其中column_name = Max(int)
2 个解决方案
#1
1
I'll assume you want the row with the highest value, not the actual 2^31-1 value
我假设您想要具有最高值的行,而不是实际的2 ^ 31-1值
SELECT TOP 1 *
FROM table_name
ORDER BY column_name DESC
If you have multiple values with the highest, to get all
如果您有多个具有最高值的值,则获取所有值
SELECT TOP 1 * WITH TIES
FROM table_name
ORDER BY column_name DESC
Let us know if you want highest per a group or other column: can be done too.
如果您希望每个组或其他列最高,请告诉我们:也可以这样做。
#2
2
select * from table_name where column_name=0x7fffffff
#1
1
I'll assume you want the row with the highest value, not the actual 2^31-1 value
我假设您想要具有最高值的行,而不是实际的2 ^ 31-1值
SELECT TOP 1 *
FROM table_name
ORDER BY column_name DESC
If you have multiple values with the highest, to get all
如果您有多个具有最高值的值,则获取所有值
SELECT TOP 1 * WITH TIES
FROM table_name
ORDER BY column_name DESC
Let us know if you want highest per a group or other column: can be done too.
如果您希望每个组或其他列最高,请告诉我们:也可以这样做。
#2
2
select * from table_name where column_name=0x7fffffff