![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
SQL
小鸿叔
我太懒了,什么也不想写。
展开
-
SQL SERVER:查询显示结果中带有行号
select row_number() over (order by [ID]) as RowID,[ID] from Table1order by [ID]原创 2018-07-18 10:35:36 · 12008 阅读 · 0 评论 -
SQL:筛选(Select)某列累加数值在N内的数据行,超出的不显示
IDScore1102938475665748392表格首先是ID升序,Score降序。目标:找出累计(合计)分数超过50的最大的几个分数,select * from test where id<=(select top 1 t.id from test twhere (select SUM(score) from test t2 where t2.id<=t.id)>50...原创 2018-07-13 17:24:37 · 1659 阅读 · 1 评论 -
SQL:计算某列累加合计
IDScore1102938475665748392表格首先是ID升序,Score降序。select *,(select SUM(score) from test t2 where t2.id<=t.id) as sum1 from test t原创 2018-07-13 17:29:41 · 13349 阅读 · 0 评论 -
SQL SERVER:数字显示千分位
select convert(varchar,cast(123123123 as money),1)原创 2018-12-06 14:55:45 · 4265 阅读 · 0 评论