genral分类帐所需的SQL查询 [英] Required SQL query for genral ledger
本文介绍了genral分类帐所需的SQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张桌子
字段是
acc_code,acc_desc,借记卡,信用卡
i想要结果怎么样
acc_desc,借记卡,信用卡,余额
AC_DESC,200,0,200
AC_DESC,0 100,100
王国有人给我sql查询?
将查询什么?
我的尝试:
选择acc_desc,借方,贷方,借方贷方余额
其中acc_code = 1001
i have a table
field are
acc_code,acc_desc, debit, credit
i want result lik
acc_desc,debit,credit, balance
AC_DESC,200,0, 200
AC_DESC,0 100, 100
kingdly anyone give me sql query?
what will be query?
What I have tried:
select acc_desc, debit, credit , debit-credit balance
where acc_code = 1001
推荐答案
有看一下Wendelious关于CodeProject的文章... 计算简单的运行总计在SQL Server中 [ ^ ]
Have a look at Wendelious' article here on CodeProject ... Calculating simple running totals in SQL Server[^]
如果您想要正确顺序的借记贷方数据,您可以使用DateTime列
E.G.
acc_code,acc_desc,debit,credit,[CreationDateTime]
使用选择声明
选择
acc_desc,
借记卡,
点数,
借记卡,
点数,
余额
其中acc_code = [YourCode]顺序[CreationDateTime]
If you want debit credit data in correct sequence the you can a a DateTime column
E.G.
acc_code,acc_desc, debit, credit , [CreationDateTime]
the use Select Statement
Select
acc_desc,
debit,
credit ,
debit,
credit,
balance
where acc_code = [YourCode] order by [CreationDateTime]
这篇关于genral分类帐所需的SQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文