如何计算日期差异和数字差异 [英] How to Calculate Date Diff And Num Diff

查看:85
本文介绍了如何计算日期差异和数字差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Glno TranscationDate存款提取TransID贷款

1003 08/06/2010 12:00:00 AM NULL 22500.0000 17088 694
1003 21/08/2010 12:00:00 AM NULL 618.0000 18436 694
1003 31/03/2011 12:00:00 AM 1303.0000 NULL 19479 694

上面的示例实际上是我的表格数据

但我需要


Glno TranscationDate存款提取NoOfDays余额贷款

1003 08/06/2010 12:00:00 AM 1303 22500.0000 296 21822 694
1003 21/08/2010 12:00:00 AM 618 NULL 222618694694

说明:

第一次提款金额大于第一次提款金额,然后是第一次提款交易日期减去(-)第一次存款交易日期,在这两个交易之间,天数计算为天数

首次提款金额-(减去)第一次存款金额为余额.
如果表中有第二笔存款金额
然后余额-第二笔存款金额和NoOfDays计算相同

如果您了解我的问题,请尽快解决并发送回复,这对我来说很重要



感谢您的回覆
非常感谢您...

如果您可能,请发送回复非常紧急

请发送回复我需要非常紧急的报告
请任何人帮我

Glno TranscationDate Deposit Withdraw TransID Loannum

1003 08/06/2010 12:00:00 AM NULL 22500.0000 17088 694
1003 21/08/2010 12:00:00 AM NULL 618.0000 18436 694
1003 31/03/2011 12:00:00 AM 1303.0000 NULL 19479 694

Above example is Actually my Table Data

But I need to


Glno TranscationDate Deposit Withdraw NoOfDays Balance Loannum

1003 08/06/2010 12:00:00 AM 1303 22500.0000 296 21822 694
1003 21/08/2010 12:00:00 AM 618 NULL 222 618 694

Description :

The first WithDrawal Amount is Grater Than First First Deposit Amount then First Withdral TransactionDate Minus(-) First Deposit Transaction Date,Between these transaction Number of Days Is Calculated to No of days
and
First Withdraw Amount -(Minus) first deposit amount is Balance.
if the second deposit amount is there in the table
then balance - second deposit amount and NoOfDays Calculation is same

if u have understand my problem plz solve and Send Reply very quickly it''s very Important to me



thanks for ur Previous Replys
Very Thanks Full to u......

If u Possible Plz send Reply Very Urgent

Plz Send Reply I need Very Urgent This Report
Plz Help Me any one

推荐答案

试试这个

Try this one

SELECT * FROM tableName
WHERE TransId IN (SELECT MIN(TransID) FROM tableName WHERE Loannum = 694)


不是与这里完全相同的问题:
Isn''t this the exact same question as here: How to Delete First Row In Sql[^]

Is the TransID now a primary key? If it is then you cold use:
DELETE FROM TableName
WHERE TransID = 17043;


但是在实际情况下,请使用
SqlParameter [


But in the real situation use SqlParameter[^]

If the TransID isn''t a primary key then as stated in the previous answer, one possibility is that you specify all of the column in the delete statement. So something like:

DELETE FROM TableName
WHERE Glno = 1003
AND   TranscationDate = '07/06/2010'
AND   Deposit         = 24300
AND   Withdraw        IS NULL
AND   TransID         = 17043 
AND   Loannum         = 694


在此示例中,您必须检查仅删除了1行(同样,如果TransID不是主键).


In this example you have to check that only 1 row is deleted (again if TransID wasn''t a primary key).


这篇关于如何计算日期差异和数字差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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