开发者

Max int value in t-SQL

开发者 https://www.devze.com 2023-04-06 05:14 出处:网络
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)select * from table_name where column_name=0x7ffffff

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)


select * from table_name where column_name=0x7fffffff


I'll assume you want the row with the highest value, not the actual 2^31-1 value

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号