位置: 编程技术 - 正文
-->Title:生成?y????BR>-->Author:wufeng-->Date :-- ::declare @T table([Col1] int,[Col2] int,[Col3] int,[Col4] int,[Col5] int,[Col6] int,[Col7] int)Insert @Tselect 1,,,,,, union allselect 2,,,,,, union allselect 3,,,,,,--方法1select [col1], max([col2])maxcolfrom (select [col1],[col2] from @t union all select [col1],[col3] from @t union all select [col1],[col4] from @t union all select [col1],[col5] from @t union all select [col1],[col6] from @t union all select [col1],[col7] from @t )Twhere [col2] between and --?l件限制group by [col1]/*col1 maxcol----------- -----------1
(3 ???料列受到影?)
*/--方法2select [col1], (select max([col2])from ( select [col2] union all select [col3] union all select [col4] union all select [col5] union all select [col6] union all select [col7] )T where [col2] between and ) as maxcol --指定查????BR>from @t/*(3 ???料列受到影?)col1 maxcol----------- -----------1 */
推荐整理分享MSSQL 多字段根据范围求最大值实现方法(mysql多字段数据),希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:sql多字段组合查询,mysql根据多个字段去重,sql多字段组合查询,mysql多字段数据,sql根据多个字段排序,sql多字段组合查询,sql多字段查询,mysql多字段数据,内容如对您有帮助,希望把文章链接给更多的朋友!
MSSQL 首字母替换成大写字母 --使用程序块--Title:生成?y???--Author:wufeng--Date:--::declare@svarchar()set@s=lower(@@version)select@s/*microsoftsqlserver-9...(intelx)nov::copy
MSSQL 提取汉字实现语句 --Title:生成?y???--Author:wufeng--Date:--::ifobject_id('dbo.get_china_str')isnotnulldropfunctiondbo.get_china_strgocreatefunctiondbo.get_china_str(@strnvarchar())returnsnvarchar
sqlserver 字符串分拆 语句 --Title:生成?y???--Author:wufeng--Date:--::ifobject_id('f_split')isnotnulldropfunctionf_splitgocreatefunctionf_split(@svarchar(),--待分拆的字符串@splitvarchar()--数
标签: mysql多字段数据
本文链接地址:https://www.jiuchutong.com/biancheng/349457.html 转载请保留说明!友情链接: 武汉网站建设