本文介绍了第二条记录与第一条记录之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的,
正在编写存储过程并遇到一些问题.请帮助我.

我的选择查询是

从TM_Node WHERE Nodedate> = @ PreDate和Nodedate< = @ PostDate和AssociateId = @ AssociateId
中选择LeftCount,RightCount
其中AssociateId是我的PrimaryKey

返回两行.
第二行的记录可能大于第一行或保持不变.

LeftCount RightCount
822 930
822 938

Diffleft = 822-822
区别权= 938-930

我想要一个查询,该查询将使我Diffleft返回0,DiffRight返回8.

Hi Dear,
Am writing a stored procedure and facing some problems.Plz help me out.

My Select Query is

SELECT LeftCount,RightCount FROM TM_Node WHERE Nodedate>=@PreDate and Nodedate<=@PostDate and AssociateId=@AssociateId

Where AssociateId is my PrimaryKey

Returning two rows.
The records of second row may be greater than the first one or remain same.

LeftCount RightCount
822 930
822 938

Diffleft = 822 - 822
DiffRight = 938 - 930

I want a query that will return me Diffleft as 0 and DiffRight as 8.

推荐答案



写道:​​

我想要一个查询,该查询将返回我Diffleft为0,DiffRight为8.

I want a query that will return me Diffleft as 0 and DiffRight as 8.



你是什​​么意思?



What do you mean ?


这篇关于第二条记录与第一条记录之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-25 11:39