我有一个带有两列整数数据的临时表,我想找到第三列中两列之间的差异.
#TEMP1
Present previous
59 88
75 75
45 45
77 88
09 08
#temp2
Difference
29
0
0
11
-1
Run Code Online (Sandbox Code Playgroud)
这可能吗 ??
我with rollup在我的SQL查询中使用.我没有获得汇总的别名.
我的SQL是
SELECT [Column1],
sum([Column2])
FROM Tablea
GROUP BY [Column2] WITH ROLLUP
Run Code Online (Sandbox Code Playgroud)
哪个回报
s 8
t 8
j 8
null 24
Run Code Online (Sandbox Code Playgroud)
如何更换NULL总排?
我在SQL Server 2008 r2下的存储过程中有两个游标.当执行存储过程时,它们正在消磨我的时间?我有2张桌子
##TEMP
CatalogID Value
34567 80
34848 100
34725 40
##Temp1
Name Percentage
A 25
B 25
C 25
D 25
Run Code Online (Sandbox Code Playgroud)
通过使用临时表iam将数据插入到目录表中并删除输入的catalogid和值.
catalogtable
CatalogID name value
34567 A 20
34567 B 20
34567 C 20
34567 D 20
34848 A 25
34848 B 25
34848 C 25
34848 D 25
34725 A 10
34725 B 10
34725 C 10
34725 D 10
Run Code Online (Sandbox Code Playgroud)
我的光标是
DECLARE Cur_Rotation CURSOR
FOR
SELECT CatalogId,Value FROM ##TEMP
DECLARE @CatalogId INT
DECLARE @Value [decimal](5, …Run Code Online (Sandbox Code Playgroud) t-sql sql-server stored-procedures cursor sql-server-2008-r2