数据重复,一个事务应该只发生一次。帮帮我吧,ThanX [英] data is repeating, one transaction should apear only once. help me with this, ThanX

查看:76
本文介绍了数据重复,一个事务应该只发生一次。帮帮我吧,ThanX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Select d.Transaction_No,d.Amount_Debit,d.Debit_Date,d.Total_Amount_Debit,c.Transaction_No,c.Amount_Credit,c.Credit_Date,c.Total_Amount_Credit from Account_Debit d left join Account_Credit c on c.Account_No=d.Account_No and  d.Account_No=''1234-5'';







TransactionNo
1	    6565	2013-01-04	883441	1	54	2013-01-04	54
1	    6565	2013-01-04	883441	2	54	2013-01-04	108
1	    6565	2013-01-04	883441	3	6565	2013-01-04	6673
1	    6565	2013-01-04	883441	4	6756	2013-01-04	13429
2	    65654	2013-01-04	949095	1	54	2013-01-04	54
2	    65654	2013-01-04	949095	2	54	2013-01-04	108
2	    65654	2013-01-04	949095	3	6565	2013-01-04	6673
2	    65654	2013-01-04	949095	4	6756	2013-01-04	13429
3	    65567	2013-01-04	1014662	1	54	2013-01-04	54
3	    65567	2013-01-04	1014662	2	54	2013-01-04	108
3	    65567	2013-01-04	1014662	3	6565	2013-01-04	6673
3	    65567	2013-01-04	1014662	4	6756	2013-01-04	13429
4	    6564	2013-01-04	1021226	1	54	2013-01-04	54
4	    6564	2013-01-04	1021226	2	54	2013-01-04	108
4	    6564	2013-01-04	1021226	3	6565	2013-01-04	6673
4	    6564	2013-01-04	1021226	4	6756	2013-01-04	13429

推荐答案

你缺少加入交易号码。使用以下查询

you have missing to join transaction nos. use below query
Select d.Transaction_No,d.Amount_Debit,d.Debit_Date,d.Total_Amount_Debit,c.Transaction_No,c.Amount_Credit,c.Credit_Date,c.Total_Amount_Credit 
from Account_Debit d 
left join Account_Credit c on c.Account_No=d.Account_No and d.Transaction_No=c.Transaction_No
where d.Account_No='1234-5';



Happy Coding!

:)


Happy Coding!
:)


这篇关于数据重复,一个事务应该只发生一次。帮帮我吧,ThanX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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