在SQL Server中从字符串中查找最大值 [英] Find Max From Strings in sql server

查看:102
本文介绍了在SQL Server中从字符串中查找最大值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据库结构就像以下内容

HdrId Critera系列
1 A 10-7
1 B 7-6
1 C 5-4
1 D 3-2

我想要具有相同HdrId的最大范围的结果,
我正在执行与表联接",

所以我应该如何找到最大范围,请帮忙. >
据我了解您的问题,我可以为您提供以下解决方案,

SELECT * FROM Table WHERE HdrId IN ( SELECT MAX(HdrId) from Table)


如果有帮助,请 投票 接受答案 .


My database Structure is like as folows

HdrId Critera Range
1 A 10-7
1 B 7-6
1 C 5-4
1 D 3-2

I want result with Max range of same HdrId ,
I am performing Joining with table,

So how should i find max Range , please help....

解决方案

I want result with Max range of same HdrId

As per as I understood your problem I could give you below solution,

SELECT * FROM Table WHERE HdrId IN ( SELECT MAX(HdrId) from Table)


Please vote and Accept Answer if it Helped.


这篇关于在SQL Server中从字符串中查找最大值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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